HI ,
I have a requirement to save and fetch data getting from ODATA service in local storage. I am able to fetch data from ODATA feed and subsequent create KendoUI DataSource. I am using this DataSource to bind to KendoUI Mobile ListView as following ,
i am able to use this DataSource in KendoUI ListView as following ,
Now I am trying to save returned data on local storage as following
and creating new DataSource where I am reading data from local storage not from the ODATA Feed as following
But it seems it is not working .. when I did console.log of JSON.stringify(speakerData.data()) .. it returns ana empty array [].
Please help me to save returned feed from ODATA or in other words save datasource.data on local storage.
Thanks
Dhananjay
I have a requirement to save and fetch data getting from ODATA service in local storage. I am able to fetch data from ODATA feed and subsequent create KendoUI DataSource. I am using this DataSource to bind to KendoUI Mobile ListView as following ,
speakerData = new kendo.data.DataSource( { type: "odata", transport: { read: { // the remote service url dataType: "jsonp", data: { Accept: "application/json" } } }, serverfiltering: true, serverPaging: true, pageSize: 10, batch: false });i am able to use this DataSource in KendoUI ListView as following ,
$("#speakersView").kendoMobileListView( { template: "<strong>${Title }</strong>", dataSource: speakerData });Now I am trying to save returned data on local storage as following
localStorage.setItem('speakerData', JSON.stringify(speakerData.data()));and creating new DataSource where I am reading data from local storage not from the ODATA Feed as following
var ospeakerData = localStorage.getItem('speakerData'); speakerData1 = JSON.parse(ospeakerData); speakerData = new kendo.data.DataSource( { transport: { read: function (options) { var data = speakerData1 options.success(data); } } });But it seems it is not working .. when I did console.log of JSON.stringify(speakerData.data()) .. it returns ana empty array [].
Please help me to save returned feed from ODATA or in other words save datasource.data on local storage.
Thanks
Dhananjay