PDA

View Full Version : [CLOSED] Multiple sorting triggers remote sorting twice



kcb
23 Apr 2013, 11:33 PM
Hello,

I am a newbie in Extjs programming however I am not a beginner in other languages. I have experienced yesterday when a tested the Multiple Sorting example http://docs.sencha.com/extjs/4.2.0/#!/example/grid/multiple-sorting.html combined with Ext Direct that after dragging the items onto the sorting toolbar it has been triggered sorting properly, however when I tried to click on the button it has made double request representing the sorting status before the event and also after the sorting event. I figured out that is in connection with some buffering mechanism coming from Ext.util.DelayedTask class. I have no idea how could it be overriden or there might exist some property I should have known.

Please help.



function changeSortDirection(button, changeDirection) {
var sortData = button.sortData,
iconCls = button.iconCls;
if (sortData) {
if (changeDirection !== false) {
button.sortData.direction = Ext.String.toggle(button.sortData.direction, "ASC", "DESC");
button.setIconCls(Ext.String.toggle(iconCls, "sort-asc", "sort-desc"));
}
store.clearFilter();
doSort();
}
}


I highlighted the code which causes the trouble. It triggers a sort event before the intended sort even fires. I suggest to remove this line from the example.
Thanks for investigating anyway.

slemmon
25 Apr 2013, 1:45 PM
I've tried a a couple of tests to see if I could reproduce the issue and wasn't seeing it.
Any chance you could post your test case?

kcb
25 Apr 2013, 11:26 PM
Hello slemmon,

I found the answer myself after debugging the code step-by-step.



function changeSortDirection(button, changeDirection) {
var sortData = button.sortData,
iconCls = button.iconCls;
if (sortData) {
if (changeDirection !== false) {
button.sortData.direction = Ext.String.toggle(button.sortData.direction, "ASC", "DESC");
button.setIconCls(Ext.String.toggle(iconCls, "sort-asc", "sort-desc"));
}
store.clearFilter();
doSort();
}
}


I highlighted the code which causes the trouble. It triggers a sort event before the intended sort even fires. I suggest to remove this line from the example.
Thanks for investigating anyway.

slemmon
26 Apr 2013, 12:13 PM
Thanks for the report! I have opened a bug in our bug tracker.