custom field ordering

A place for users and developers of the Xataface to discuss and receive support.

custom field ordering

Postby 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!
marksawers
 
Posts: 7
Joined: Wed Apr 16, 2008 1:09 pm
Location: Fairfield, CT

Postby 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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 20 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved