Knockout-Contrib / KoGrid

A Knockout DataGrid

Home Page:https://knockout-contrib.github.io/KoGrid/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SortInfo - executed twice on subscribe

Gutek opened this issue · 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 :(