Good morning,
i need to save column sorting and other filters within a grid.
The only method i figured out is this:
I save the current grid state to the browser local storage
$(window).on("beforeunload", function () { var GType = '@Model.flowCatalogId' + '@Model.flowTypeCatalogId' + '@Model.filterVersion' + '@ViewBag.Lang' + '_grid_filtered'; var grid = $("#grid_filtered").data("kendoGrid"); localStorage["QSW-grid-Claim-List" + GType] = utf8_to_b64(kendo.stringify(grid.getOptions())); })
Then i reload it every time i enter the page at the end of it's load
$(document).ready(function () {
$('body').css('pointer-events', 'all') //activate all pointer-events on body
$('#dialog_pos').data("kendoDialog").close();
$('#dialog_pos_supp').data("kendoDialog").close();
$('#dialog_create').data("kendoDialog").close();
var GType = '@Model.flowCatalogId' + '@Model.flowTypeCatalogId' + '@Model.filterVersion' + '@ViewBag.Lang' + '_grid_filtered';
var grid = $("#grid_filtered").data("kendoGrid");
if (localStorage["QSW-grid-Claim-List" + GType]) {
var options = b64_to_utf8(localStorage["QSW-grid-Claim-List" + GType]);
grid.setOptions(JSON.parse(options));
}
else
{
for (i = 0; i < localStorage.length; i++) {
x = localStorage.key(i);
if (x.includes("QSW")) { localStorage.removeItem(x);}
}
}
$('#btnCreate').click(function (e) {
$(this).prop('disabled', true);
$('#create_form').submit();
});
});This works but it do the read function of my grid 2 times.
.Read(read => read.Action("Claims_Read_Filtered", "Claim", new { flowCatalogId = Model.flowCatalogId, flowTypeCatalogId = Model.flowTypeCatalogId, Model.DateFrom, Model.DateTo})