I've searched everywhere and have finally come here to ask for help :)
Has anyone had any success using ESRI's REST services with a Kendo DataSource?
The problem is that the REST service is not just returning the results. It has a bunch of "meta" data in the JSON before the result set, and it actually encloses the results in an array of objects. Each object has a "geometry" field and an "attributes" field. The actual results are in the attributes field.
So... here is what I have for the transport.read:
Here is the model:
And here is the column set I use in the Grid to display. Note I have to use "attributes.<field_name>" in order for it to display properly.
The initial issue was that the row in the grid was disappearing if I hit EDIT then CANCEL. I found out why that is happening - it's because all of the field values I have defined in the datasource are undefined.
Any help is greatly appreciated!
K
Has anyone had any success using ESRI's REST services with a Kendo DataSource?
The problem is that the REST service is not just returning the results. It has a bunch of "meta" data in the JSON before the result set, and it actually encloses the results in an array of objects. Each object has a "geometry" field and an "attributes" field. The actual results are in the attributes field.
So... here is what I have for the transport.read:
transport: { read: function(options) { $.ajax({ url: crudBaseUrl + "/query", dataType: "json", data: { f: "json", token: token, outFields: "*", returnGeometry: true, outSR: 3857, where: "LN_NO='" + ownerid + "'" }, type: "POST", success: function(result) { window.successResult = result; options.success(result.features); } }); },Here is the model:
model: { id: "OBJECTID", fields: { OBJECTID: { type: "number", editable: false }, LN_NO: { type: "string" }, QSEC: { type: "string" }, SECTION: { type: "string" }, TOWNSHIP: { type: "string" }, N_S: { type: "string" }, RANGE: { type: "string" }, E_W: { type: "string" }, AF: { type: "string" }, LATITUDE: { type: "string" }, LONGITUDE: { type: "string" }, METHODCODE: { type: "string" }, REFERENCE: { type: "string" }, ACCURACY: { type: "string" }, R: { type: "string" } }}And here is the column set I use in the Grid to display. Note I have to use "attributes.<field_name>" in order for it to display properly.
columns: [ { field: "attributes.OBJECTID", title: "OID", }, { field: "attributes.LN_NO", title: "Loc Number", }, { field: "attributes.QSEC", title: "QSEC" }, { field: "attributes.SECTION", title: "Section", }, { field: "attributes.TOWNSHIP", title: "Township" }, { field: "attributes.N_S", title: "N / S" }, { field: "attributes.RANGE", title: "Range" }, { field: "attributes.E_W", title: "E / W" }, { field: "attributes.AF", title: "Acre/Feet" }, { field: "attributes.LATITUDE", title: "Latitude" }, { field: "attributes.LONGITUDE", title: "Longitude" }, { field: "attributes.METHODCODE", title: "Method Code" }, { field: "attributes.REFERENCE", title: "Reference" }, { field: "attributes.ACCURACY", title: "Accuracy" }, { field: "attributes.R", title: "Reservation" }, { command: ["edit", "destroy"], title: " ", width: "200px" } ],The initial issue was that the row in the grid was disappearing if I hit EDIT then CANCEL. I found out why that is happening - it's because all of the field values I have defined in the datasource are undefined.
Any help is greatly appreciated!
K