0

I have asked this question before two months but did not get an answer or even a comment/reply. So posting it again

I have an ExtJs grid having sort functionality. (ExtJS 2.3.0)

I am sorting the columns as follows-

sort: function (colName, direction) {
       //
       // Some sort logic
       //
       this.fireEvent("datachanged", this);
}

This is working fine. The columns get sorted successfully.

Now I Have a button above my grid called 'Remove Sort'. On click of this button, I want to remove the applied sorting.

I tried-

removeSort: function (colName, direction) {
    // some logic
    //
    store.sortInfo = null; // This will remove the sortinfo (working as expected)
    grid.saveState(); // Saves the sort state (working as expected)
    this.fireEvent("datachanged", this);
}

In above code store.sortInfo = null; removes sortinfo and saves the state. But here "datachanged" is not firing. Means, it do not refreshes the grid on 'Remove sort' button.

I know I can use reload() function of grid but here I dont want to reload the grid. I want it should refresh the grid instantly just like it does when I sort the columns.

Please suggest a solution.

Microsoft DN
  • 9,706
  • 10
  • 51
  • 71

1 Answers1

0

In removeSort try not to use keyword this but use direct references to the store object, eg. store.fireEvent("datachanged", store );

Grzegorz Adam Kowalski
  • 5,243
  • 3
  • 29
  • 40