extjs4.1extjs-gridextjs-stores

Sorting one column based on another column in ExtJs 4.1 grid


I am using ExtJs 4.1 framework. I have a grid which shows only one column (Name). The grid is associated with a store which have two fields (Name and SortOrder). The field "name" in store is associated with Name column of the grid. I want to sort the name column based on the value available in SortOrder field in the store. How can I implement such logic.

Thank you


Solution

  • Do you mean something like this:

    ...
    columns: [{
        header: 'Name',
        dataIndex: 'Name',
        sortable: true,
        doSort: function(state){
            var ds = this.up('tablepanel').store;
            ds.sort({
                property: 'SortOrder',
                direction: state
            });
        }
        ....    
    }]