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

Request #9548 I need to set default order modes for each column.
Submitted: 2006-12-05 15:11 UTC
From: hire at ukr dot net Assigned: olivierg
Status: Closed Package: Structures_DataGrid_Renderer_Smarty (version CVS)
PHP Version: 5.1.6 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2006-12-05 15:11 UTC] hire at ukr dot net (Anton)
Description: ------------ Now: When I click to sort each column, it lists them in ascending order, then I have to click again to sort in descending order. Need: First click on column X - ascending order, but when I click to sort column Y need to sort in descending order. In other words I need to set default order modes for each column. Test script: --------------- /** Changes in php files: file Smarty.php #249: $direction = 'ASC'; replace to: if (isset($this->_options['sortableFieldsDefault']) && array_key_exists($spec['field'], $this->_options['sortableFieldsDefault'])) { $direction = $this->_options['sortableFieldsDefault'][$spec['field']]; } else { $direction = 'ASC'; } **/ // array example $arrSort = array( "user_login" => "ASC", "user_email" => "ASC", "user_invitation_count" => "DESC", "user_invitation_valid" => "DESC" ); ); /* @var $Datagrid Structures_DataGrid */ $Datagrid->setRendererOption('sortableFieldsDefault', $arrSort);

Comments

 [2006-12-05 16:02 UTC] olivierg at php dot net (Olivier Guilyardi)
Hi Anton, This is a legitimate request to me. I'm not sure that I will code it as you propose, but I'll include this new feature soon.
 [2006-12-08 16:55 UTC] olivierg at php dot net (Olivier Guilyardi)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.
 [2006-12-08 17:09 UTC] olivierg at php dot net (Olivier Guilyardi)
Anton, for your information I've added a new SDG_Column::setDefaultDirection() method. Usage example: $column =& $datagrid->getColumnByField("data_field"); $column->setDefaultDirection("DESC");