I have a Kendo UI DataSource that works when I use fetch(), but when I use the exact same configurtation with read() it fails. This is a problem as I need to retrieve data more than once and I can't do that with fetch().
Here is the DataSource code -
Here is the code that calls the DataSource.read() function - function loadFields() {
If I change "FieldsDataSource.read(function()" to "FieldsDataSource.fetch(function()" everything works, but that doesn't make sense as I was under the impressionthat read and fetch do the same thing the difference being fetch only gets data once.
What I do know is that the data is being returned from the server, I can see it in fiddler - but the execution stops in the schema section where I flagged it in my code sample.
Apologies if I am asking a really obvious question, but I'm very new to Kendo.
Here is the DataSource code -
var FieldsDataSource = new kendo.data.DataSource({transport: {read: {url: "../WebServiceAddress",dataType: "json",type: "POST",contentType: 'application/json; charset=utf-8',cache: false}, parameterMap: function() {return "{some mapping that has been confirmed to work}";},schema: {data: function (data) {if (data && data.d) {//execution gets to here and stopsreturn data.d; }else {return [];}},} });Here is the code that calls the DataSource.read() function - function loadFields() {
FieldsDataSource.read(function() {var data = this.data();if (data.length > 0) {for (var i = 0; i < data.length; i++) {var dataitem = data[i].Key;$("#" + dataitem + "_field").prop("checked", data[i].Value);}}});}If I change "FieldsDataSource.read(function()" to "FieldsDataSource.fetch(function()" everything works, but that doesn't make sense as I was under the impressionthat read and fetch do the same thing the difference being fetch only gets data once.
What I do know is that the data is being returned from the server, I can see it in fiddler - but the execution stops in the schema section where I flagged it in my code sample.
Apologies if I am asking a really obvious question, but I'm very new to Kendo.