PDA

View Full Version : Trigger a sort event on a column/grid panel



ahsec
3 Jun 2012, 3:15 AM
Does anyone know how I do it ?

thanks

sdt6585
3 Jun 2012, 6:07 PM
The column/grid panel already fires a sortchanged event whenever it is sorted.

If you are trying to sort by a column in code, you want to call the sort() method of the grid's store on a particular column, or just by itself to use the default sorting set up in the store definition. Check out the sorter documentation that is in the grid (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.Panel), and store (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.Store)sections of the API documentation. If you need a more in depth understanding or are doing something more complicated, review the Ext.util.Sorter (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.util.Sorter) documentation.

A quick example:


myGrid.store.sort({'myField', 'ASC'});