var store = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: 'treeData.json'
},
root: {
text: 'Countries',
expanded: true
},
sorters: [{
property: 'text',
direction: 'ASC' //for descending change to 'DESC'
}]
});
Ext.create('Ext.Button', {
text: 'Sort Tree',
renderTo: Ext.getBody(),
handler: function() {
//this will toggle ASC & DESC automatically for you.
store.sort('text');
//or we can force a direction like so:
store.sort('text', 'DESC');
}
});
댓글 없음:
댓글 쓰기