Re: strange behavior on Structures Datagrid 0.6
| From: | Alexander Petri | Date: | Sat, 15 Jan 2005 13:09:52 +0000 |
| Subject: | Re: strange behavior on Structures Datagrid 0.6 | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16940@lists.php.net to get a copy of this message | ||
i found the mistake for myself:
in my app i did this
$count=$user->find();
$dg = &new Structures_DataGrid(30, $page);
$dg->bind($user);
i had to put the line with $count after
..->bind() ->then it works...
"Alexander Petri" <alex.petri@gmx.de> schrieb im Newsbeitrag
news:20050114170024.80086.qmail@lists.php.net...
> i bind a simply DataObject to Structures Datagrid
> like this:
>
> <?php
> require_once '../ini/config.php';
> require_once '../inc/LinkAccess.class.php';
> require_once('Structures/DataGrid.php');
> // Determine sort order and direction as well as the page to display
> $page = isset($_GET['page']) ? $_GET['page'] : 1;
> $orderBy = isset($_GET['orderBy']) ? $_GET['orderBy'] :
> 'username';
> $dir = isset($_GET['direction']) ? $_GET['direction'] : 'ASC';
>
>
> // Define the Data Source for the DataGrid
> $user = DB_DataObject::factory('user');
> $user->whereAdd('login_status < 100');
> $user->whereAdd('plz > 60000');
> $user->whereAdd('plz < 60500');
>
> // Create the DataGrid, Bind it's Data Source and Define it's columns
> $dg = &new Structures_DataGrid(30, $page);
> $dg->bind($user);
> $dg->sortRecordSet($orderBy, $dir);
>
> $dg->addColumn(new Structures_DataGrid_Column('Username', 'username',
> 'username'));
> $dg->addColumn(new Structures_DataGrid_Column('Anrede', 'anrede',
> 'anrede'));
> $dg->addColumn(new Structures_DataGrid_Column('Vorname', 'vorname',
> 'vorname'));
> $dg->addColumn(new Structures_DataGrid_Column('Nachname', 'nachname',
> 'nachname'));
> $dg->addColumn(new Structures_DataGrid_Column('Straße', 'strasse',
> 'strasse'));
> $dg->addColumn(new Structures_DataGrid_Column('PLZ', 'plz',
> 'plz'));
> $dg->addColumn(new Structures_DataGrid_Column('Ort', 'ort',
> 'ort'));
> $dg->addColumn(new Structures_DataGrid_Column('Land', 'land_iso3166',
> 'land_iso3166'));
>
> $column = new Structures_DataGrid_Column('Show', null, null,
array('align'
> => 'center'), null, null,
> 'LinkAccess::printLink($label=Show,$bereich=user,$funktion=show)');
> $dg->addColumn($column);
>
> $column = new Structures_DataGrid_Column('Passwort', null, null,
> array('align' => 'center'), null, null,
>
'LinkAccess::printLink($label=zurücksetzen,$bereich=user,$funktion=pwd)');
> $dg->addColumn($column);
>
> // Define the Look and Feel
> $dg->renderer->setTableHeaderAttributes(array('bgcolor' =>
> 'CCCCCC'));
> $dg->renderer->setTableEvenRowAttributes(array('bgcolor' =>
> '#FFFFFF'));
> $dg->renderer->setTableOddRowAttributes(array('bgcolor' =>
> '#EEEEEE'));
> $dg->renderer->setTableAttribute('width', '100%');
> $dg->renderer->setTableAttribute('cellspacing', '0');
> $dg->renderer->setTableAttribute('cellpadding', '4');
> $dg->renderer->sortIconASC = "<img src=\"../img/az.gif\"
> border=\"0\">";
> $dg->renderer->sortIconDESC = "<img src=\"../img/za.gif\"
> border=\"0\">";
>
> // Print the DataGrid and the Paging
> $dg->render();
> //echo $dg->renderer->getPaging();
> echo
> $dg->renderer->getPaging('Sliding','|','«','»',3,array(
> 'spacesBeforeSeparator'=>1,
> 'spacesAfterSeparator'=>1,
> 'firstPagePre' => "",
> 'firstPageText' => "zum Anfang",
> 'firstPagePost' => '',
> 'lastPagePre' => '',
> 'lastPageText' => 'zum Ende',
> 'lastPagePost' => ''
> ));
> ?>
> ############################################################
>
> now i added this to my app and then
> sorting, paging wont work..
>
> it only shows page one with my default values...
> i can catch the values submittet by $_GET
> the error must be somwhere else... but i didnt find it..
> can someone give me a hint?