New to Kendo UI for jQuery? Download free 30-day trial

Filtering Is Not Properly Persisted after Saving and Loading the State of the Grid


Product Progress Kendo UI Grid
Operating System Windows 10 64bit
Browser Google Chrome
Browser Version 60.0.3112.101


The filters of the Grid are not correctly persisted after its state is saved and loaded. How can I properly persist the filtering and avoid the rendering of incorrect data in the Grid?


The JSON.stringify() method that is internally used by the kendo.stringify() method utilizes the Date.prototype.toISOString function which represents time in unmodified UTC format.


Programmatically apply the time offset before the filter is set again.


    <div id="example">
      <div class="box wide">
        <a href="#" class="k-button" id="save">Save State</a>
        <a href="#" class="k-button" id="load">Load State</a>
      <div id="grid"></div>

        $(document).ready(function () {
          var saved;
            dataSource: {
              type: "odata",
              transport: {
                read: ""
              pageSize: 20
            height: 550,
            groupable: true,
            sortable: true,
            reorderable: true,
            resizable: true,
            columnMenu: true,
            pageable: {
              refresh: true,
              pageSizes: true,
              buttonCount: 5
            columns: [{
              field: "MeetingID",
              title: "Meeting",
              width: 250,
              locked: true
            }, {
              field: "Start",
              title: "Start",
              width: 350,
              type: "date",
              format: "{0:MM/dd/yy hh:mmtt}"
            }, {
              field: "End",
              title: "End",
              width: 350,
              type: "date",
              format: "{0:MM/dd/yy hh:mmtt}"
            }, {
              field: "RoomID",
              width: 450

          var grid = $("#grid").data("kendoGrid");

          $("#save").click(function (e) {
            saved = true;
            localStorage["kendo-grid-options"] = kendo.stringify(grid.getOptions());

          $("#load").click(function (e) {
            var options = localStorage["kendo-grid-options"];
            if (options) {
              var parsedOptions = JSON.parse(options)
              if(saved && parsedOptions.dataSource.filter != undefined){
                for (let i = 0; i<parsedOptions.dataSource.filter.filters.length; i++ ){
                  if(parsedOptions.dataSource.filter.filters[i].field = "Start"){
                    // Take the current offset
                    var currentoffset = (new Date()).getTimezoneOffset()
                    var newTime = new Date(parsedOptions.dataSource.filter.filters[i].value)
                    // Set the offset to the date
                    newTime.setHours(newTime.getHours() + currentoffset/60);
                    parsedOptions.dataSource.filter.filters[i].value = newTime
                saved = false;



In this article
Not finding the help you need? Improve this article