Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.3

Bug #4403 Structures_DataGrid_sortRecordSet
Submitted: 2005-05-22 00:16 UTC
From: ar dot newsgroup at gmx dot de Assigned: asnagy
Status: Closed Package: Structures_DataGrid
PHP Version: 5.0.4 OS: Windows 2000
Roadmaps: (Not assigned)    
Subscription  


 [2005-05-22 00:16 UTC] ar dot newsgroup at gmx dot de
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!

Comments

 [2005-06-10 19:08 UTC] jessup at mrpath dot com
I don't know if this is the same bug or a very similar one but I came across a bug with not sorting when not using the built in dataSource functionality. In DataGrid/Core.php function sortRecordSet(...): $this->sortArray needs to be set for the usort($this->recordSet, array($this, '_sort')) call to work. Right now, it's set after so the usort call raises some errors and fails to sort.
 [2005-07-13 16:59 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2009-10-19 16:27 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!