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] asnagy
Jessup's Bug is now fixed. As for the sorting with DataObjects, I know that this is a heavily used feature and is working well. Please investigate this further, and determine if it is indeed a bug or not.
 [2009-10-19 16:27 UTC] arvindh (arvindh kumar)
Still I have the problem in sorting. The arguments are getting passed correctly. But the sorting doesn't work. any help?