Jsgrid: Persistent sort order

Created on 17 Apr 2018  路  2Comments  路  Source: tabalinas/jsgrid

When I call the loadData function, the sort order does not persist. Is there an easy way to do this? The data gets refreshed when I get an event from the database but I'd like to keep the grid where it was. It also looks like the grid is trying to persist the sort as the icon for the column sorted is still present, however, the data isn't updated to reflect that.

Most helpful comment

I fixed it with the below code, but I guess I'm curious why I had to do that, when the documentation for loadData says that it preserves the sort and filter?

        $('#mamGrid').jsGrid("loadData").done(function () {
            var sorting = $("#mamGrid").jsGrid("getSorting");
            $("#mamGrid").jsGrid("sort", sorting);
        });

All 2 comments

I fixed it with the below code, but I guess I'm curious why I had to do that, when the documentation for loadData says that it preserves the sort and filter?

        $('#mamGrid').jsGrid("loadData").done(function () {
            var sorting = $("#mamGrid").jsGrid("getSorting");
            $("#mamGrid").jsGrid("sort", sorting);
        });

Thanks! That works, and I'm really curious why it does not work when writing to the done() in the controller.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andymacourek picture andymacourek  路  3Comments

danielson317 picture danielson317  路  3Comments

GlennSeymon picture GlennSeymon  路  5Comments

gianlucaqo picture gianlucaqo  路  4Comments

eliasuardi picture eliasuardi  路  3Comments