custom field ordering
Archived from the Xataface Users forum.
marksawers — Thu Apr 17, 2008 2:15 pm
Is it possible to declaratively configure the column order, say in the list tab? For example, is there some visibility:list -like directive for fields.ini? Very often my table layout is not my view layout and I’d rather not implement the renderRowHeader and renderRow slots.
Thanks!
shannah — Sat Apr 19, 2008 7:45 am
No, not really. There is just the one order property that applies to all aspects of the app.
You can define an init() method in your delegate class which is executed just after the table is loaded, if you want to sort the fields.
e.g.
- Code: Select all
- `function init(&$table){
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
if ( $query[‘-action’] == ‘list’ ){
$fields =& $table->_fields;
uasort($fields, array(&$this, ‘sortFieldsForList’));
}
}function sortFieldsForList($a, $b){
if ( @$a[‘listorder’] > @$b[‘listorder’] ) return 1;
else if $a[‘listorder’] < @$b[‘listorder’] ) return -1;
else return 0;
}`
Then use the listorder fields.ini parameter to specify the order in the list view.
-Steve