State persistence of reordered columns on JQuery Kendo UI Grid with MVVM binding












1














I have A Jquery Kendo UI Grid with MVVM binding, Here is the html code on Razor
view



<div data-role="grid"
id="dvJobGoalGrid"
data-groupable="true"
data-sortable="true"
data-filterable="{'mode':'row'}"
data-pageable="{pageSize:20}"
data-pageSize="defaultRowsPerPage"
data-reorderable="true"
data-column-menu="true"
data-columns="[
{'field': 'SJobID', 'title':'Job ID', 'width': 150,
'template': '#= viewModel.JobIdTemplate(SJobID) #',
'filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
{'field': 'DisplayName', 'title':'Name','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
{'field': 'PName', 'title':'POT Name','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
{'field': 'JobDesc', 'title':'Description','width': 450, 'filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
{'field': 'MgGShortDesc', 'title':'MG','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
{'field': 'RGDesc', 'title':'RGD','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
{'field': 'CategoryShortDesc', 'title':'Category','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
{'field': 'JobStatusDesc', 'title':'Status','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
{'field': 'RGDesc', 'title':'RG','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
{'field': 'Api', 'title':'API','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }}
]"
data-bind="source: goalJobs">
</div>


Following is JQuery viewModel



var viewModel = kendo.observable({
isVisible: true,
gridRowsPerpage: [10,20,30,40],
defaultRowsPerPage: 10,
goalJobs: new kendo.data.DataSource({
schema: {
data: function (data) {
return data.value;
},
total: function (data) {
return data['odata.count'];
},
model: {
fields: {
JobID: { type: "number" },
SJobID: { type: "string" },
DisplayName: { type: "string" },
PName: { type: "string" },
JobDesc: { type: "string" },
MgGShortDesc: { type: "string" },
RGroupDesc: { type: "string" },
CategoryShortDesc: { type: "string" },
JobStatusDesc: { type: "string" },
RGroupDesc: { type: "string" },
Api: { type: "string" },
Area: { type: "string" },
LastUpdatedDate: { type: "date" },
}
}
},
sort: {
field: "LastUpdatedDate",
dir: "desc"
},
filter: {
logic: "and",
filters: [{ field: "GW", operator: "eq", value: true },
{ field: "JobStatusID", operator: "eq", value: 1 }]
},
type: "odata",
transport: {
read: {
url: MYURL
dataType: "json"
}
},
pageSize: 10,
serverPaging: true,
serverFiltering: true,
serverSorting: true
}),
rowNumberSelected: function (n) {
this.goalJobs.pageSize(this.defaultRowsPerPage);
console.log(n);
},
searchChanged: function () {
var searchVal = viewModel.searchText;
var existingFilters;
var globalSearchFilter = {
pageSize: 10,
logic: "or",
filters: [
{ field: "SJobID", operator: "contains", value: searchVal },
{ field: "DisplayName", operator: "contains", value: searchVal },
{ field: "PName", operator: "contains", value: searchVal },
{ field: "JobDesc", operator: "contains", value: searchVal },
{ field: "MgGShortDesc", operator: "contains", value: searchVal },
{ field: "RGroupDesc", operator: "contains", value: searchVal },
{ field: "CategoryShortDesc", operator: "contains", value: searchVal },
{ field: "JobStatusDesc", operator: "contains", value: searchVal },
{ field: "RGroupDesc", operator: "contains", value: searchVal },
{ field: "Api", operator: "contains", value: searchVal }]
};
if (viewModel.goalJobs.filter()) {
existingFilters = viewModel.goalJobs.filter();
existingFilters.filters.push(globalSearchFilter);
globalSearchFilter = existingFilters;
}
viewModel.goalJobs.filter(globalSearchFilter);
},
clearAllFilters: function () {
viewModel.goalJobs.filter();
viewModel.goalJobs.filter({ filters: [{ field: "Goal", operator: "eq", value: true }] });
viewModel.set("searchText", "");
},
searchText: "",
JobIdTemplate: function (jobid) {
return '<a href="/goto/' + jobid + '" target="_blank">' + jobid + '</a>';
},
loadSettings: function () {
if (localStorage["dvJobGoalGrid-grid-filters"]) {
viewModel.goalJobs.filter(JSON.parse(localStorage["dvJobGoalGrid-grid-filters"]));
}
if (localStorage["dvJobGoalGrid-grid-groups"]) {
viewModel.goalJobs.group(JSON.parse(localStorage["dvJobGoalGrid-grid-groups"]));
}
}
});
kendo.bind($("#dvJobs"), viewModel);
viewModel.loadSettings();


I am trying to save user's preferences (options), like when the user changes column order, grouping, and/or apply filters, in localstorage and when that user comes back to the page browser should read the localstorage and apply it to the Grid. I was able find how to do that with filters and grouping using following code which runs when user goes away from the webpage.



   window.onbeforeunload = function () {
localStorage["dvJobGoalGrid-grid-filters"] = JSON.stringify(viewModel.goalJobs.filter());
localStorage["dvJobGoalGrid-grid-groups"] = JSON.stringify(viewModel.goalJobs.group());
return;
}


And following code reads localstorate and applies the filters and groping to the grid



kendo.bind($("#dvJobs"), viewModel);
viewModel.loadSettings();


But I could not find how to retrieve reordered columns list from viewModel.goalJobs and could not find how to apply it dynamically.



Is there a way to store all setting (options) when user leaves the page and apply the same when he/she comes back?. There are some examples of how to do this using non-MVVM way of binding, but I could not see any thing with MVVM.










share|improve this question



























    1














    I have A Jquery Kendo UI Grid with MVVM binding, Here is the html code on Razor
    view



    <div data-role="grid"
    id="dvJobGoalGrid"
    data-groupable="true"
    data-sortable="true"
    data-filterable="{'mode':'row'}"
    data-pageable="{pageSize:20}"
    data-pageSize="defaultRowsPerPage"
    data-reorderable="true"
    data-column-menu="true"
    data-columns="[
    {'field': 'SJobID', 'title':'Job ID', 'width': 150,
    'template': '#= viewModel.JobIdTemplate(SJobID) #',
    'filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
    {'field': 'DisplayName', 'title':'Name','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
    {'field': 'PName', 'title':'POT Name','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
    {'field': 'JobDesc', 'title':'Description','width': 450, 'filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
    {'field': 'MgGShortDesc', 'title':'MG','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
    {'field': 'RGDesc', 'title':'RGD','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
    {'field': 'CategoryShortDesc', 'title':'Category','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
    {'field': 'JobStatusDesc', 'title':'Status','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
    {'field': 'RGDesc', 'title':'RG','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
    {'field': 'Api', 'title':'API','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }}
    ]"
    data-bind="source: goalJobs">
    </div>


    Following is JQuery viewModel



    var viewModel = kendo.observable({
    isVisible: true,
    gridRowsPerpage: [10,20,30,40],
    defaultRowsPerPage: 10,
    goalJobs: new kendo.data.DataSource({
    schema: {
    data: function (data) {
    return data.value;
    },
    total: function (data) {
    return data['odata.count'];
    },
    model: {
    fields: {
    JobID: { type: "number" },
    SJobID: { type: "string" },
    DisplayName: { type: "string" },
    PName: { type: "string" },
    JobDesc: { type: "string" },
    MgGShortDesc: { type: "string" },
    RGroupDesc: { type: "string" },
    CategoryShortDesc: { type: "string" },
    JobStatusDesc: { type: "string" },
    RGroupDesc: { type: "string" },
    Api: { type: "string" },
    Area: { type: "string" },
    LastUpdatedDate: { type: "date" },
    }
    }
    },
    sort: {
    field: "LastUpdatedDate",
    dir: "desc"
    },
    filter: {
    logic: "and",
    filters: [{ field: "GW", operator: "eq", value: true },
    { field: "JobStatusID", operator: "eq", value: 1 }]
    },
    type: "odata",
    transport: {
    read: {
    url: MYURL
    dataType: "json"
    }
    },
    pageSize: 10,
    serverPaging: true,
    serverFiltering: true,
    serverSorting: true
    }),
    rowNumberSelected: function (n) {
    this.goalJobs.pageSize(this.defaultRowsPerPage);
    console.log(n);
    },
    searchChanged: function () {
    var searchVal = viewModel.searchText;
    var existingFilters;
    var globalSearchFilter = {
    pageSize: 10,
    logic: "or",
    filters: [
    { field: "SJobID", operator: "contains", value: searchVal },
    { field: "DisplayName", operator: "contains", value: searchVal },
    { field: "PName", operator: "contains", value: searchVal },
    { field: "JobDesc", operator: "contains", value: searchVal },
    { field: "MgGShortDesc", operator: "contains", value: searchVal },
    { field: "RGroupDesc", operator: "contains", value: searchVal },
    { field: "CategoryShortDesc", operator: "contains", value: searchVal },
    { field: "JobStatusDesc", operator: "contains", value: searchVal },
    { field: "RGroupDesc", operator: "contains", value: searchVal },
    { field: "Api", operator: "contains", value: searchVal }]
    };
    if (viewModel.goalJobs.filter()) {
    existingFilters = viewModel.goalJobs.filter();
    existingFilters.filters.push(globalSearchFilter);
    globalSearchFilter = existingFilters;
    }
    viewModel.goalJobs.filter(globalSearchFilter);
    },
    clearAllFilters: function () {
    viewModel.goalJobs.filter();
    viewModel.goalJobs.filter({ filters: [{ field: "Goal", operator: "eq", value: true }] });
    viewModel.set("searchText", "");
    },
    searchText: "",
    JobIdTemplate: function (jobid) {
    return '<a href="/goto/' + jobid + '" target="_blank">' + jobid + '</a>';
    },
    loadSettings: function () {
    if (localStorage["dvJobGoalGrid-grid-filters"]) {
    viewModel.goalJobs.filter(JSON.parse(localStorage["dvJobGoalGrid-grid-filters"]));
    }
    if (localStorage["dvJobGoalGrid-grid-groups"]) {
    viewModel.goalJobs.group(JSON.parse(localStorage["dvJobGoalGrid-grid-groups"]));
    }
    }
    });
    kendo.bind($("#dvJobs"), viewModel);
    viewModel.loadSettings();


    I am trying to save user's preferences (options), like when the user changes column order, grouping, and/or apply filters, in localstorage and when that user comes back to the page browser should read the localstorage and apply it to the Grid. I was able find how to do that with filters and grouping using following code which runs when user goes away from the webpage.



       window.onbeforeunload = function () {
    localStorage["dvJobGoalGrid-grid-filters"] = JSON.stringify(viewModel.goalJobs.filter());
    localStorage["dvJobGoalGrid-grid-groups"] = JSON.stringify(viewModel.goalJobs.group());
    return;
    }


    And following code reads localstorate and applies the filters and groping to the grid



    kendo.bind($("#dvJobs"), viewModel);
    viewModel.loadSettings();


    But I could not find how to retrieve reordered columns list from viewModel.goalJobs and could not find how to apply it dynamically.



    Is there a way to store all setting (options) when user leaves the page and apply the same when he/she comes back?. There are some examples of how to do this using non-MVVM way of binding, but I could not see any thing with MVVM.










    share|improve this question

























      1












      1








      1







      I have A Jquery Kendo UI Grid with MVVM binding, Here is the html code on Razor
      view



      <div data-role="grid"
      id="dvJobGoalGrid"
      data-groupable="true"
      data-sortable="true"
      data-filterable="{'mode':'row'}"
      data-pageable="{pageSize:20}"
      data-pageSize="defaultRowsPerPage"
      data-reorderable="true"
      data-column-menu="true"
      data-columns="[
      {'field': 'SJobID', 'title':'Job ID', 'width': 150,
      'template': '#= viewModel.JobIdTemplate(SJobID) #',
      'filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'DisplayName', 'title':'Name','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'PName', 'title':'POT Name','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'JobDesc', 'title':'Description','width': 450, 'filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'MgGShortDesc', 'title':'MG','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'RGDesc', 'title':'RGD','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'CategoryShortDesc', 'title':'Category','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'JobStatusDesc', 'title':'Status','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'RGDesc', 'title':'RG','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'Api', 'title':'API','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }}
      ]"
      data-bind="source: goalJobs">
      </div>


      Following is JQuery viewModel



      var viewModel = kendo.observable({
      isVisible: true,
      gridRowsPerpage: [10,20,30,40],
      defaultRowsPerPage: 10,
      goalJobs: new kendo.data.DataSource({
      schema: {
      data: function (data) {
      return data.value;
      },
      total: function (data) {
      return data['odata.count'];
      },
      model: {
      fields: {
      JobID: { type: "number" },
      SJobID: { type: "string" },
      DisplayName: { type: "string" },
      PName: { type: "string" },
      JobDesc: { type: "string" },
      MgGShortDesc: { type: "string" },
      RGroupDesc: { type: "string" },
      CategoryShortDesc: { type: "string" },
      JobStatusDesc: { type: "string" },
      RGroupDesc: { type: "string" },
      Api: { type: "string" },
      Area: { type: "string" },
      LastUpdatedDate: { type: "date" },
      }
      }
      },
      sort: {
      field: "LastUpdatedDate",
      dir: "desc"
      },
      filter: {
      logic: "and",
      filters: [{ field: "GW", operator: "eq", value: true },
      { field: "JobStatusID", operator: "eq", value: 1 }]
      },
      type: "odata",
      transport: {
      read: {
      url: MYURL
      dataType: "json"
      }
      },
      pageSize: 10,
      serverPaging: true,
      serverFiltering: true,
      serverSorting: true
      }),
      rowNumberSelected: function (n) {
      this.goalJobs.pageSize(this.defaultRowsPerPage);
      console.log(n);
      },
      searchChanged: function () {
      var searchVal = viewModel.searchText;
      var existingFilters;
      var globalSearchFilter = {
      pageSize: 10,
      logic: "or",
      filters: [
      { field: "SJobID", operator: "contains", value: searchVal },
      { field: "DisplayName", operator: "contains", value: searchVal },
      { field: "PName", operator: "contains", value: searchVal },
      { field: "JobDesc", operator: "contains", value: searchVal },
      { field: "MgGShortDesc", operator: "contains", value: searchVal },
      { field: "RGroupDesc", operator: "contains", value: searchVal },
      { field: "CategoryShortDesc", operator: "contains", value: searchVal },
      { field: "JobStatusDesc", operator: "contains", value: searchVal },
      { field: "RGroupDesc", operator: "contains", value: searchVal },
      { field: "Api", operator: "contains", value: searchVal }]
      };
      if (viewModel.goalJobs.filter()) {
      existingFilters = viewModel.goalJobs.filter();
      existingFilters.filters.push(globalSearchFilter);
      globalSearchFilter = existingFilters;
      }
      viewModel.goalJobs.filter(globalSearchFilter);
      },
      clearAllFilters: function () {
      viewModel.goalJobs.filter();
      viewModel.goalJobs.filter({ filters: [{ field: "Goal", operator: "eq", value: true }] });
      viewModel.set("searchText", "");
      },
      searchText: "",
      JobIdTemplate: function (jobid) {
      return '<a href="/goto/' + jobid + '" target="_blank">' + jobid + '</a>';
      },
      loadSettings: function () {
      if (localStorage["dvJobGoalGrid-grid-filters"]) {
      viewModel.goalJobs.filter(JSON.parse(localStorage["dvJobGoalGrid-grid-filters"]));
      }
      if (localStorage["dvJobGoalGrid-grid-groups"]) {
      viewModel.goalJobs.group(JSON.parse(localStorage["dvJobGoalGrid-grid-groups"]));
      }
      }
      });
      kendo.bind($("#dvJobs"), viewModel);
      viewModel.loadSettings();


      I am trying to save user's preferences (options), like when the user changes column order, grouping, and/or apply filters, in localstorage and when that user comes back to the page browser should read the localstorage and apply it to the Grid. I was able find how to do that with filters and grouping using following code which runs when user goes away from the webpage.



         window.onbeforeunload = function () {
      localStorage["dvJobGoalGrid-grid-filters"] = JSON.stringify(viewModel.goalJobs.filter());
      localStorage["dvJobGoalGrid-grid-groups"] = JSON.stringify(viewModel.goalJobs.group());
      return;
      }


      And following code reads localstorate and applies the filters and groping to the grid



      kendo.bind($("#dvJobs"), viewModel);
      viewModel.loadSettings();


      But I could not find how to retrieve reordered columns list from viewModel.goalJobs and could not find how to apply it dynamically.



      Is there a way to store all setting (options) when user leaves the page and apply the same when he/she comes back?. There are some examples of how to do this using non-MVVM way of binding, but I could not see any thing with MVVM.










      share|improve this question













      I have A Jquery Kendo UI Grid with MVVM binding, Here is the html code on Razor
      view



      <div data-role="grid"
      id="dvJobGoalGrid"
      data-groupable="true"
      data-sortable="true"
      data-filterable="{'mode':'row'}"
      data-pageable="{pageSize:20}"
      data-pageSize="defaultRowsPerPage"
      data-reorderable="true"
      data-column-menu="true"
      data-columns="[
      {'field': 'SJobID', 'title':'Job ID', 'width': 150,
      'template': '#= viewModel.JobIdTemplate(SJobID) #',
      'filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'DisplayName', 'title':'Name','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'PName', 'title':'POT Name','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'JobDesc', 'title':'Description','width': 450, 'filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'MgGShortDesc', 'title':'MG','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'RGDesc', 'title':'RGD','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'CategoryShortDesc', 'title':'Category','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'JobStatusDesc', 'title':'Status','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'RGDesc', 'title':'RG','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }},
      {'field': 'Api', 'title':'API','filterable': { 'cell': { 'showOperators': false, 'operator': 'contains' } }}
      ]"
      data-bind="source: goalJobs">
      </div>


      Following is JQuery viewModel



      var viewModel = kendo.observable({
      isVisible: true,
      gridRowsPerpage: [10,20,30,40],
      defaultRowsPerPage: 10,
      goalJobs: new kendo.data.DataSource({
      schema: {
      data: function (data) {
      return data.value;
      },
      total: function (data) {
      return data['odata.count'];
      },
      model: {
      fields: {
      JobID: { type: "number" },
      SJobID: { type: "string" },
      DisplayName: { type: "string" },
      PName: { type: "string" },
      JobDesc: { type: "string" },
      MgGShortDesc: { type: "string" },
      RGroupDesc: { type: "string" },
      CategoryShortDesc: { type: "string" },
      JobStatusDesc: { type: "string" },
      RGroupDesc: { type: "string" },
      Api: { type: "string" },
      Area: { type: "string" },
      LastUpdatedDate: { type: "date" },
      }
      }
      },
      sort: {
      field: "LastUpdatedDate",
      dir: "desc"
      },
      filter: {
      logic: "and",
      filters: [{ field: "GW", operator: "eq", value: true },
      { field: "JobStatusID", operator: "eq", value: 1 }]
      },
      type: "odata",
      transport: {
      read: {
      url: MYURL
      dataType: "json"
      }
      },
      pageSize: 10,
      serverPaging: true,
      serverFiltering: true,
      serverSorting: true
      }),
      rowNumberSelected: function (n) {
      this.goalJobs.pageSize(this.defaultRowsPerPage);
      console.log(n);
      },
      searchChanged: function () {
      var searchVal = viewModel.searchText;
      var existingFilters;
      var globalSearchFilter = {
      pageSize: 10,
      logic: "or",
      filters: [
      { field: "SJobID", operator: "contains", value: searchVal },
      { field: "DisplayName", operator: "contains", value: searchVal },
      { field: "PName", operator: "contains", value: searchVal },
      { field: "JobDesc", operator: "contains", value: searchVal },
      { field: "MgGShortDesc", operator: "contains", value: searchVal },
      { field: "RGroupDesc", operator: "contains", value: searchVal },
      { field: "CategoryShortDesc", operator: "contains", value: searchVal },
      { field: "JobStatusDesc", operator: "contains", value: searchVal },
      { field: "RGroupDesc", operator: "contains", value: searchVal },
      { field: "Api", operator: "contains", value: searchVal }]
      };
      if (viewModel.goalJobs.filter()) {
      existingFilters = viewModel.goalJobs.filter();
      existingFilters.filters.push(globalSearchFilter);
      globalSearchFilter = existingFilters;
      }
      viewModel.goalJobs.filter(globalSearchFilter);
      },
      clearAllFilters: function () {
      viewModel.goalJobs.filter();
      viewModel.goalJobs.filter({ filters: [{ field: "Goal", operator: "eq", value: true }] });
      viewModel.set("searchText", "");
      },
      searchText: "",
      JobIdTemplate: function (jobid) {
      return '<a href="/goto/' + jobid + '" target="_blank">' + jobid + '</a>';
      },
      loadSettings: function () {
      if (localStorage["dvJobGoalGrid-grid-filters"]) {
      viewModel.goalJobs.filter(JSON.parse(localStorage["dvJobGoalGrid-grid-filters"]));
      }
      if (localStorage["dvJobGoalGrid-grid-groups"]) {
      viewModel.goalJobs.group(JSON.parse(localStorage["dvJobGoalGrid-grid-groups"]));
      }
      }
      });
      kendo.bind($("#dvJobs"), viewModel);
      viewModel.loadSettings();


      I am trying to save user's preferences (options), like when the user changes column order, grouping, and/or apply filters, in localstorage and when that user comes back to the page browser should read the localstorage and apply it to the Grid. I was able find how to do that with filters and grouping using following code which runs when user goes away from the webpage.



         window.onbeforeunload = function () {
      localStorage["dvJobGoalGrid-grid-filters"] = JSON.stringify(viewModel.goalJobs.filter());
      localStorage["dvJobGoalGrid-grid-groups"] = JSON.stringify(viewModel.goalJobs.group());
      return;
      }


      And following code reads localstorate and applies the filters and groping to the grid



      kendo.bind($("#dvJobs"), viewModel);
      viewModel.loadSettings();


      But I could not find how to retrieve reordered columns list from viewModel.goalJobs and could not find how to apply it dynamically.



      Is there a way to store all setting (options) when user leaves the page and apply the same when he/she comes back?. There are some examples of how to do this using non-MVVM way of binding, but I could not see any thing with MVVM.







      c# jquery mvvm kendo-ui kendo-mvvm






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 9 at 18:08









      venu

      58111




      58111





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53231192%2fstate-persistence-of-reordered-columns-on-jquery-kendo-ui-grid-with-mvvm-binding%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53231192%2fstate-persistence-of-reordered-columns-on-jquery-kendo-ui-grid-with-mvvm-binding%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Florida Star v. B. J. F.

          Danny Elfman

          Lugert, Oklahoma