I made my custom adaptor:
var customAdaptor = new ej.UrlAdaptor().extend({
processResponse: function (data, ds, query, xhr, request, changes) {
// here is some logik for preparig data
return {
count: dataCount,
data: preparedData
};
},
processQuery: function (dm, query, hierarchyFilters) {
return {
url: "https://services/.../service1.svc/GetFetchXMLResponse",
async: true,
type: "POST",
dataType: 'json',
contentType: "application/json",
data: fetchXMLData,
}
}
});
This is the code where I provide my custom adopter to grid data manager. URL below is unimportant because in "processQuery" method in my custom adaptor I always change call to some other service.
var dataManager = ej.DataManager({
url:"http://mvc.syncfusion.com/Services/Northwnd.svc/Foods",
adaptor: new customAdaptor()
});
$("#grid").ejGrid({
dataSource: dataManager,
});
This code causes error in console: "Cannot read property '0' of undefined".
I do not understand what I am doing wrong. Line "61551" in ej.web.all.js file make a problem beacuse "this.model.currentViewData" is undefined. Line is below:
for (this._gridRecordsCount ? this._initColumns(this.model.currentViewData[0] != r ? this.model.currentViewData[0] : this.model.currentViewData.value) : this._isLocalData && (this._dataSource() != null && this._dataSource().length || this._dataManager && this._dataManager.dataSource.json.length) && this._initColumns(this._dataSource()[0] != r ? this._dataSource()[0] : this._dataManager.dataSource.json[0]),
Any help please ?