Bug #4403 [NEW]: Structures_DataGrid_sortRecordSet
| From: | ar dot newsgroup at gmx dot de | Date: | Sun, 22 May 2005 00:17:07 +0000 |
| Subject: | Bug #4403 [NEW]: Structures_DataGrid_sortRecordSet | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-6058@lists.php.net to get a copy of this message | ||
From: ar dot newsgroup at gmx dot de
Operating system: Windows 2000
PHP version: 5.0.4
Package: Documentation
Bug Type: Bug
Bug description: Structures_DataGrid_sortRecordSet
Description:
------------
Versions:
DB_DataObject: 1.7.13
Structures_DataGrid: 0.6.2
---------------
There is a bug by sorting method in Structures_DataGrid_sortRecordSet in
combination with DB_DataObject DataSource binding!
With Structures_DataGrid_sortRecordSet you can not sort any DataObject
Tables! I think it is caused by the wrong method call in sortRecordSet
($this->_dataSource->sort($sortBy, $direction). In DB_DataObject class the
sorting method is called "orderBy()" !!!
Befor instantiating a DataGrid if I call the orderBy method of
DB_DataObject it works fine.
I hope it is a bug! If not, please show me my mistake!
greetings...
abbas
Reproduce code:
---------------
$orderBy = isset($_GET['orderBy']) ? $_GET['orderBy'] : 'Time';
$dir = isset($_GET['direction']) ? $_GET['direction'] : 'ASC';
$do = DB_DataObject::factory('log');
// this is my workaround
$do->orderBy($orderBy . " " . $dir);
$num_of_rows = $do->find();
$dg =& new Structures_DataGrid(15);
$data = Structures_DataGrid_DataSource::create($do);
$dg->bindDataSource($data);
// this is not working
//$dg->sortRecordSet($orderBy, $dir);
Expected result:
----------------
with:
$dg->sortRecordSet($orderBy, $dir);
NO sorting!!!
but with:
$do->orderBy($orderBy . " " . $dir);
sorting works fine!
--
Edit bug report at http://pear.php.net/bugs/bug.php?id=4403&edit=1
--