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

Doc Bug #11854 sort_property doc wrong
Submitted: 2007-08-17 11:51 UTC
From: madsliejensen Assigned: olivierg
Status: Closed Package: Structures_DataGrid_DataSource_DataObject (version 0.2.0)
PHP Version: 5.2.3 OS: Linux
Roadmaps: (Not assigned)    
Comments Add Comment Add patch

Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem : 11 + 40 = ?

 [2007-08-17 11:51 UTC] madsliejensen (Mads Lie Jensen)
Description: ------------ The documentation says that sort_property should be an array like: array('field1', 'field2 DESC', ...) However, this seems to be wrong, the above will result in this SQL: ' .. ORDER BY "field1", "field2 DESC" ... ' having all quoted, and giving an error from the database. Instead, if sorting-direction is to be given, it has to be like: array('field1', array('field2' => 'DESC')); This would give the more correct SQL: ' .. ORDER BY "field1", "field2" DESC ...'


 [2007-12-05 13:11 UTC] olivierg (Olivier Guilyardi)
Hello Mads, Thanks for reporting this issue, but it's no documentation problem. It actually was a bug. In SDG the sorting parameters are array(field1 => ASC, field2 => DESC, etc...) However, the sort_property option is a bit special because it is meant to be compatible with formbuilder's linkOrderFields option. So the documentation is right, you must use array("field1", "field2 DESC", ...), and there was a bug in the code. But it's now fixed.