Re: Re: Limited db paging with datagrid
| From: | Andrew Nagy | Date: | Wed, 05 Jan 2005 16:39:47 +0000 |
| Subject: | Re: Re: Limited db paging with datagrid | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16661@lists.php.net to get a copy of this message | ||
daniel@electroteque.org wrote:
Here is the code $dg =& new Structures_DataGrid(15,$_GET['page']); $pagerOptions = array(I just tried my pager hack with a project I am working on and was successful. Make sure that you set the _totalItems equal to your total number of items, which in your case is 22.'mode' => 'Sliding', 'delta' => 2,'perPage' => 15, ); $paged_data = Pager_Wrapper::getData('MDB',$db, "select * from users", $pagerOptions);$dg->renderer->setTableHeaderAttributes(array('bgcolor' => 'CCCCCC','class'=>'header'));$dg->renderer->setTableEvenRowAttributes(array('bgcolor' => '#FFFFFF')); $dg->renderer->setTableOddRowAttributes(array('bgcolor' => '#EEEEEE')); $dg->renderer->setTableAttribute('cellspacing', '0'); $dg->renderer->setTableAttribute('cellpadding', '0'); $dg->bind($paged_data['data']); $dg->pager->_totalItems = $paged_data['totalItems']; $dg->render(); echo $dg->renderer->getPaging(); I am only seeming to get 15 and not a page 2 as there is 22 rows. There seems to be the pagingfunctions on the html renderer and smarty renderer ?
I have also looked at the smarty renderer, and there is no example.tpl ? How easy would it be toconvert to Flexy ?The smarty renderer is ver undeveloped. I use smarty all the time and i commonly assign html output ($dg->renderer->toHTML()) to my smarty template.
I am looking at customising the renderer and placing in my custom class path so its calledHTMLTableCustom or Flexy if I can work out how to create a renderer for Flexy, it seemed to loadfine like this $dg =& new Structures_DataGrid(15,$_GET['page'],'HTMLTableCustom');If you want to create your own flexy renderer, just create a new file called Flexy.php in the renderer directory and then call: $dg =*& new Structures_DataGrid(20, 1, 'Flexy'); If you do this, send it on to me and I will put it in CVS Andrew