Re: DataGrid: problems with paging
| From: | Justin Patrin | Date: | Sun, 20 Nov 2005 04:59:24 +0000 |
| Subject: | Re: DataGrid: problems with paging | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-22012@lists.php.net to get a copy of this message | ||
On 11/19/05, Mark Steudel <mark@netriver.net> wrote:
> Not sure what happened but this morning I came in and it worked ...
>
> Sorry to be dense what does PK stand for?
Primark Key.
>
> Thanks, Mark
>
> >-----Original Message-----
> >From: Justin Patrin [mailto:papercrane@gmail.com]
> >Sent: Friday, November 18, 2005 9:37 PM
> >To: Mark Steudel
> >Cc: pear-general@lists.php.net
> >Subject: Re: [PEAR] DataGrid: problems with paging
> >
> >On 11/18/05, Mark Steudel <mark@netriver.net> wrote:
> >> I have 25 records in the tblMenu table, and I set it to show
> >5 records
> >> per page. When I get the paging, I only get 1 | 2 >>
> >>
> >>
> >> require('Structures/DataGrid.php');
> >>
> >> $dg =& new Structures_DataGrid(5);
> >>
> >> // fetch menu data from db
> >> $res =& $db->query( "SELECT * FROM tblMenu" ); mysqlErrorCheck($res);
> >>
> >
> >Perhaps try a numRows() on your res to make sure it returns
> >25. Also, make sure your PK is set up correctly.
> >
> >> $dg->bind($res);
> >>
> >> // assign content to template
> >> $tpl->assign('content', $dg->renderer->toHTML($dg));
> >> $tpl->assign('pagination', $dg->renderer->getPaging())
> >>
> >>
> >> I also tried it this way, but I get "Undefined class name
> >> 'structures_datagrid_datasource'"
> >>
> >>
> >> require('Structures/DataGrid.php');
> >>
> >> $dg =& new Structures_DataGrid(5);
> >>
> >> // fetch user data from db
> >> $res =& $db->query( "SELECT * FROM tblMenu" ); mysqlErrorCheck($res);
> >>
> >> $data = Structures_DataGrid_DataSource::create($res);
> >> $dg->bindDataSource($data);
> >>
> >> $dg->renderer->setTableHeaderAttributes(array('bgcolor' =>
> >> '#4A497B'));
> >> $dg->renderer->setTableOddRowAttributes(array('bgcolor'
> >> => '#CCCCCC'));
> >> $dg->renderer->setTableEvenRowAttributes(array('bgcolor' =>
> >> '#EEEEEE'));
> >>
> >>
> >> $dg->renderer->sortIconASC = "⇑";
> >> $dg->renderer->sortIconDESC =
> >> "⇓";
> >>
> >> $dg->addColumn(new Structures_DataGrid_Column('Name', 'name',
> >> 'name')); $dg->addColumn(new
> >Structures_DataGrid_Column('URL', 'url',
> >> 'url')); $dg->addColumn(new
> >Structures_DataGrid_Column('Date', 'date',
> >> 'date'));
> >>
> >>
> >> // assign content to template
> >> $tpl->assign('content', $dg->renderer->toHTML($dg));
> >> $tpl->assign('pagination', $dg->renderer->getPaging());
> >>
> >> TIA, mark
> >>
> >> --
> >> PEAR General Mailing List (http://pear.php.net/) To unsubscribe,
> >> visit: http://www.php.net/unsub.php
> >>
> >>
> >
> >
> >--
> >Justin Patrin
> >
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Justin Patrin