I need to reset to the first page after sorting the grid. I was trying to use the change event like i was doing when changing page which works perfectly here is my example on how I keep track of my paging.
var pageable = false;
if (self.Pageable == true)
pageable = {
refresh: false,
pageSizes: self.PageSizes,
change: function(e) {
if (typeof (Storage) !== "undefined") {
localStorage.setItem(self.PageStorageVariable, self.Grid().dataSource.page());
}
}
};
and then apply pageable variable to my grid definition
var g = {
scrollable: false,
pageable : pageable ,
...
}
Every time I change a page it gets stored in my local storage and then I do some stuff with it.
I need the same functionality for sorting but only on the on change event:
var sortable = false;
if (self.Sortable == true)
sortable = {
mode: "single",
allowUnsort: true,
change: function (e) {
console.log('here');
}
};
var g = {
scrollable: false,
pageable : pageable ,
sortable : sortable,
...
};
But in this case every time I apply a new sort its not firing my on change function, any ideas on how can I intercept the onSort event so I can reset to page 1 when sorting?
var pageable = false;
if (self.Pageable == true)
pageable = {
refresh: false,
pageSizes: self.PageSizes,
change: function(e) {
if (typeof (Storage) !== "undefined") {
localStorage.setItem(self.PageStorageVariable, self.Grid().dataSource.page());
}
}
};
and then apply pageable variable to my grid definition
var g = {
scrollable: false,
pageable : pageable ,
...
}
Every time I change a page it gets stored in my local storage and then I do some stuff with it.
I need the same functionality for sorting but only on the on change event:
var sortable = false;
if (self.Sortable == true)
sortable = {
mode: "single",
allowUnsort: true,
change: function (e) {
console.log('here');
}
};
var g = {
scrollable: false,
pageable : pageable ,
sortable : sortable,
...
};
But in this case every time I apply a new sort its not firing my on change function, any ideas on how can I intercept the onSort event so I can reset to page 1 when sorting?