KoGrid icon indicating copy to clipboard operation
KoGrid copied to clipboard

SortInfo - executed twice on subscribe

Open Gutek opened this issue 12 years ago • 0 comments

If you are using sortInfo it will be executed twice in code:

self.sortData = function (col, direction) {
    // if external sorting is being used, do nothing.
    self.isSorting = true;
    self.sortInfo({ // this is causing first execution
        column: col,
        direction: direction
    });
    self.clearSortingData(col);
    if(!self.config.useExternalSorting){
        window.kg.sortService.Sort(self.sortInfo.peek(), self.sortedData);
    } else {
        self.config.sortInfo(self.sortInfo.peek()); // this second one
    }
    self.lastSortedColumn = col;
    self.isSorting = false;
};

solution is quite straight forward, delay self.sortInfo change

will try to do pull request but I don't have access to git from my work :(

Gutek avatar Nov 18 '13 11:11 Gutek