QPaginator position

thread: 8 messages  |  last: about 2 years ago  |  started: monday, december 28, 2009, 6:38 am pst


#1  |  DivisionBell Argentina
Monday, December 28, 2009, 6:38 AM PST

Hello everyone...I want to know if I can change the position of the paginator in a datagrid. I would like to have the paginator in the foot of the datagrid. If someone could help me I would be very pleased...Thankss!

PD: Ah, sorry if my english sucks :P jaj

#2  |  Leonardo (Minas Gerais) Brazil
Monday, December 28, 2009, 10:35 AM PST

Mostrar romanização
Yes, it's just rendering the paginator at the bottom of the datagrid you can do everything you want to tell the truth. Just have to get used to a little rendereização controls and ready.

#3  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Monday, December 28, 2009, 11:07 AM PST

You can see the examples site at http://examples.qcodo.com/examples/datagrid/extend.php for more information.

Basically, you just want to override GetFooterRowHtml in your QDataGrid class and you should be set.

#4  |  DivisionBell Argentina
Tuesday, December 29, 2009, 6:02 AM PST

Thank you for your reply. I have already did that, but the paginator is showing in the header and in the footer, I want to show it only in the footer. Thankss!

#5  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Monday, January 4, 2010, 8:22 AM PST

If you only want it in the footer, and if you are using the examples, then simply do not define a primary paginator. ONly use the alternate.

#6  |  DivisionBell Argentina
Monday, January 4, 2010, 10:06 AM PST

Yes I did that but I need to define a primary paginator in order to sets ItemsPerPage and TotalItemCount properties...If I dont define a primary paginator I get an exception:

Setting ItemsPerPage requires a Paginator to be set
Exception Type:   QCallerException

If I dont sets ItemsPerPage and TotalItemCount properties I have the paginator in the footer like I want, but it is incomplete...

Thankss!

#7  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Monday, January 4, 2010, 11:25 AM PST

Ah, good point.

Then I think the best approach would be to only set a primary (no alternate)

Then override GetPaginatorRowHtml to not render anything.

And then of course override GetFooterRowHtml to render the primary paginator instead of the alternate.

#8  |  DivisionBell Argentina
Monday, January 4, 2010, 12:13 PM PST

Thank you Mikee! I have overwritten the two functions and it works fine for me now :)

protected function GetPaginatorRowHtml($objPaginator) {
    return "";
}

protected function GetFooterRowHtml() {            
    $paginator = "  <span class=\"right\">";
    $paginator .= $this->objPaginator->Render(false);
    $paginator .= "</span>\r\n  <span class=\"left\">";
    if ($this->TotalItemCount > 0) {
        $intStart = (($this->PageNumber - 1) * $this->ItemsPerPage) + 1;
        $intEnd = $intStart + count($this->DataSource) - 1;
        $paginator .= sprintf($this->strLabelForPaginated,
            $this->strNounPlural,
            $intStart,
            $intEnd,
            $this->TotalItemCount);
    } else {
        $intCount = count($this->objDataSource);
        if ($intCount == 0)
            $paginator .= sprintf($this->strLabelForNoneFound, $this->strNounPlural);
        else if ($intCount == 1)
            $paginator .= sprintf($this->strLabelForOneFound, $this->strNoun);
        else
            $paginator .= sprintf($this->strLabelForMultipleFound, $intCount, $this->strNounPlural);
    }

    $paginator .= "</span>\r\n";
    
    if ($this->objPaginator)
            return sprintf('<tr><td colspan="%s">%s</td></tr>', count($this->objColumnArray), $paginator);    
    
}

Thankks!



Copyright © 2005 - 2012, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.