Reputation: 5096
I'm using ExtJs 3.4 and I have a TreeGrid (Ext.ux.tree.TreeGrid)
with a column model.
The sorting works very well with the data brought by a TreeGridLoader
when you click on every column's header, but I want to sort by a default specified column
.
Is there a way to achieve that? I want to specify that, like I said I don't have a store, instead I have a TreeGridLoader defined.
UPDATE
Thanks to wes
the best(and general) solution for my problem would be:
// simulate click on order number and order by this column
var treeGrid = Ext.getCmp('siteStructureGrid');
var index = 0;
for (var i = 0; i<treeGrid.columns.length; i++){
if (treeGrid.columns[i].id == 'orderNumberColumn'){
index = i;
}
}
var column = treeGrid.columns[index];
treeGrid.fireEvent('headerClick', column);
Upvotes: 1
Views: 2860
Reputation: 8185
One method may be to call the header's click handler. Normally I'd frown on that, but it's handling a bunch of tasks rather than calling a single public sort method. IMO the TreeGrid UX isn't very well fleshed out.
// grab the column and fire the click, since it works for you
var column = treeGrid.columns[index];
treeGrid.fireEvent('headerClick', column);
Upvotes: 2