PDA

View Full Version : sorting colums byField (colum has multiple values)



Julie
28 Apr 2009, 5:00 AM
Hello all,
i have the followiing Data from the Database

$Companies[$i]['company'] = "<a href=\"".$html->url('/exp/mycompanies/'.$Companies[$i]['Company']['id'])."\">".htmlentities($Companies[$i]['Company']['name1'])." ".htmlentities($Companies[$i]['Company']['name2'])."</a>";
if (!empty($Companies[$i]['Company']['phone']) && trim($Companies[$i]['Company']['phone']) != "")
$Companies[$i]['company'] .= "<br>Tel.: ".$Companies[$i]['Company']['phone'];


my Store is :

var ds = new Ext.data.Store({
reader: new Ext.data.JsonReader({
root: 'Sompanies',
fields: [

{name: 'company'}
]

})
});


var cm = new Ext.grid.ColumnModel([

{header: "<?php echo __('entreprise',true);?>", width:65, dataIndex: 'company',sortable: true}

]);

i can see my company column ist sorted by company id!! why?? any idea whow to sort it by name??

thanks in advance

bt_bruno
29 Apr 2009, 3:03 AM
var store = new Ext.data.Store({
sortInfo: { field:"company", dir:"ASC"}
...
})


In addition you can use remoteSort. If true you would have to sort it on server, if false Ext does it.