I'm using a custom read function to create a datasource for a combobox:
function createDataSource(id, system) {
return new kendo.data.DataSource({
serverFiltering: true,
transport: {
read: function (operation) {
var url = "/api/Navigator/" + system + "/";
$.getJSON(url, { Criteria0: combobox.text() }, function (json) {
operation.success(json);
});
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return kendo.stringify(options.models);
}
}
},
schema: { data: "Nav" }
})
}
Where "Nav" is the table pulled across from the API call. The fields I'm interested in are GUID and Display. The API is used several other places with those field names so I'd prefer keeping them as they are and I don't necessarily want to duplicate code and have a separate API call or pass the field names to the db to rename them before the data is returned. Is there a way in the datasource (perhaps using a specified model) to rename the GUID and Display columns to something like "PersonGUID" and "Person" if those parameters are passed in the function call?
Thanks for your help.
Bryan
function createDataSource(id, system) {
return new kendo.data.DataSource({
serverFiltering: true,
transport: {
read: function (operation) {
var url = "/api/Navigator/" + system + "/";
$.getJSON(url, { Criteria0: combobox.text() }, function (json) {
operation.success(json);
});
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return kendo.stringify(options.models);
}
}
},
schema: { data: "Nav" }
})
}
Where "Nav" is the table pulled across from the API call. The fields I'm interested in are GUID and Display. The API is used several other places with those field names so I'd prefer keeping them as they are and I don't necessarily want to duplicate code and have a separate API call or pass the field names to the db to rename them before the data is returned. Is there a way in the datasource (perhaps using a specified model) to rename the GUID and Display columns to something like "PersonGUID" and "Person" if those parameters are passed in the function call?
Thanks for your help.
Bryan