Hi Markus,
I still have some things to work out with the dev version before letting it loose... but I think the following will help you achieve ordering properly.Ê In the Dataface/ResultList.php file, replace the constructor function so that it is:
function Dataface_ResultList( $tablename, $db='', $columns=array(), $query=array()){
ÊÊÊÊ ÊÊÊ $app =& Dataface_Application::getInstance();
ÊÊÊÊ ÊÊÊ $this->_tablename = $tablename;
ÊÊÊÊ ÊÊÊ if (empty($db) ) $db = $app->db();
ÊÊÊÊ ÊÊÊ $this->_db = $db;
ÊÊÊÊ ÊÊÊ $this->_columns = $columns;
ÊÊÊÊ ÊÊÊ if ( !is_array($columns) ) $this->_columns = array();
ÊÊÊÊ ÊÊÊ $this->_query = $query;
ÊÊÊÊ ÊÊÊ if( !is_array($query) ) $this->_query = array();
ÊÊÊÊ ÊÊÊ
ÊÊÊÊ ÊÊÊ $this->_table =& Dataface_Table::loadTable($tablename);
ÊÊÊÊ ÊÊÊ $fieldnames = array_keys($this->_table->fields(false,true));
ÊÊÊÊ ÊÊÊ $fields =& $this->_table->fields(false,true);
ÊÊÊÊ ÊÊÊ
ÊÊÊÊ ÊÊÊ if ( count($this->_columns)==0 ){
ÊÊÊÊ ÊÊÊ ÊÊÊ
ÊÊÊÊ ÊÊÊ ÊÊÊ foreach ($fieldnames as $field){
ÊÊÊÊ ÊÊÊ ÊÊÊ ÊÊÊ if ( @$fields[$field]['filter'] ) $this->_filterCols[] = $field;
ÊÊÊÊ ÊÊÊ ÊÊÊ ÊÊÊ if ( $fields[$field]['visibility']['list'] != 'visible') continue;
ÊÊÊÊ ÊÊÊ ÊÊÊ ÊÊÊ ÊÊÊ if ( $this->_table->isPassword($field) ) continue;
ÊÊÊÊ ÊÊÊ ÊÊÊ ÊÊÊ if ( isset( $fields[$field] ) and !eregi('blob', $fields[$field]['Type']) ){
ÊÊÊÊ ÊÊÊ ÊÊÊ ÊÊÊ ÊÊÊ $this->_columns[] = $field;
ÊÊÊÊ ÊÊÊ ÊÊÊ ÊÊÊ }
ÊÊÊÊ ÊÊÊ ÊÊÊ }
ÊÊÊÊ ÊÊÊ ÊÊÊ /*
ÊÊÊÊ ÊÊÊ ÊÊÊ $grafted_fields = $this->_table->graftedFields();
ÊÊÊÊ ÊÊÊ ÊÊÊ $grafted_fieldnames = array_keys($grafted_fields);
ÊÊÊÊ ÊÊÊ ÊÊÊ foreach ($grafted_fieldnames as $field){
ÊÊÊÊ ÊÊÊ ÊÊÊ ÊÊÊ if ( $grafted_fields[$field]['visibility']['list'] != 'visible') continue;
ÊÊÊÊ ÊÊÊ ÊÊÊ ÊÊÊ $this->_columns[] = $field;
ÊÊÊÊ ÊÊÊ ÊÊÊ }*/
ÊÊÊÊ ÊÊÊ } else {
ÊÊÊÊ ÊÊÊ ÊÊÊ
ÊÊÊÊ ÊÊÊ
ÊÊÊÊ ÊÊÊ ÊÊÊ foreach ($fieldnames as $field){
ÊÊÊÊ ÊÊÊ ÊÊÊ ÊÊÊ if ( @$fields[$field]['filter'] ) $this->_filterCols[] = $field;
ÊÊÊÊ ÊÊÊ ÊÊÊ }
ÊÊÊÊ ÊÊÊ }
ÊÊÊÊ ÊÊÊ
ÊÊÊÊ ÊÊÊ $this->_resultSet =& Dataface_QueryTool::loadResult($tablename, $db, $query);
ÊÊÊÊ ÊÊÊ
ÊÊÊÊ }
This should make it so that the order of the columns obeys the order set in the fields.ini file (this is just a cut and paste from the dev version, but I think it should work in the current release also.
-Steve