DataManager - executeLocal() : Json data is required to execute error even with basic example
Error: DataManager - executeLocal() : Json data is required to execute
at f (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:1139:64978)
at t.DataManager.executeLocal (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:1139:3131)
at Object._ensureDataSource (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:11131:471296)
at Object._checkDataBinding (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:11131:447859)
at Object._init (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:11131:442830)
at new
at r.fn.init.n.fn.(anonymous function) [as ejGrid] (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:738:22661)
at GridComponent.EJComponents.ngAfterViewInit (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:923:64)
at callProviderLifecycles (http://localhost:49464/dist/vendor.js?v=nMqkQ_LZ_CiGyFvzk1Kt7hliVxlW_KJUCW7-pcLGavQ:22246:18)
at callElementProvidersLifecycles (http://localhost:49464/dist/vendor.js?v=nMqkQ_LZ_CiGyFvzk1Kt7hliVxlW_KJUCW7-pcLGavQ:22217:13)
at f (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:1139:64978)
at t.DataManager.executeLocal (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:1139:3131)
at Object._ensureDataSource (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:11131:471296)
at Object._checkDataBinding (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:11131:447859)
at Object._init (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:11131:442830)
at new
at r.fn.init.n.fn.(anonymous function) [as ejGrid] (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:738:22661)
at GridComponent.EJComponents.ngAfterViewInit (http://localhost:49464/dist/main-client.js?v=4sT28-oKDCFU-IE1IjkuoH_f_AVBAsMSpRnH5Dbxgts:923:64)
at callProviderLifecycles (http://localhost:49464/dist/vendor.js?v=nMqkQ_LZ_CiGyFvzk1Kt7hliVxlW_KJUCW7-pcLGavQ:22246:18)
at callElementProvidersLifecycles (http://localhost:49464/dist/vendor.js?v=nMqkQ_LZ_CiGyFvzk1Kt7hliVxlW_KJUCW7-pcLGavQ:22217:13)
at viewWrappedDebugError (http://localhost:49464/dist/vendor.js?v=nMqkQ_LZ_CiGyFvzk1Kt7hliVxlW_KJUCW7-pcLGavQ:19492:15)
at callWithDebugContext (http://localhost:49464/dist/vendor.js?v=nMqkQ_LZ_CiGyFvzk1Kt7hliVxlW_KJUCW7-pcLGavQ:24547:15)
at Object.debugCheckAndUpdateView [as checkAndUpdateView] (http://localhost:49464/dist/vendor.js?v=nMqkQ_LZ_CiGyFvzk1Kt7hliVxlW_KJUCW7-pcLGavQ:24077:12)
at ViewRef_.detectChanges (http://localhost:49464/dist/vendor.js?v=nMqkQ_LZ_CiGyFvzk1Kt7hliVxlW_KJUCW7-pcLGavQ:21244:18)
at http://localhost:49464/dist/vendor.js?v=nMqkQ_LZ_CiGyFvzk1Kt7hliVxlW_KJUCW7-pcLGavQ:15882:63
at Array.forEach (
at ApplicationRef_.tick (http://localhost:49464/dist/vendor.js?v=nMqkQ_LZ_CiGyFvzk1Kt7hliVxlW_KJUCW7-pcLGavQ:15882:25)
at http://localhost:49464/dist/vendor.js?v=nMqkQ_LZ_CiGyFvzk1Kt7hliVxlW_KJUCW7-pcLGavQ:15754:106
at ZoneDelegate.invoke (http://localhost:49464/dist/vendor.js?v=nMqkQ_LZ_CiGyFvzk1Kt7hliVxlW_KJUCW7-pcLGavQ:86745:26)
at Object.onInvoke (http://localhost:49464/dist/vendor.js?v=nMqkQ_LZ_CiGyFvzk1Kt7hliVxlW_KJUCW7-pcLGavQ:14960:33)
Attachment: gridexamplecomponent_1c138984.zip
|
var promise=this.dataManager.executeQuery(new ej.Query().addParams('$top', '7'));
promise.done(function (e) {
ej.parseJSON(e.result); //parse the data to json object
});
} |
|
this.dataManager = new DataManager({ url: 'http://services.odata.org/V4/Northwind/Northwind.svc/Orders', adaptor: new ODataV4Adaptor }); |
|
this.dataManager = ej.DataManager({ url: 'http://services.odata.org/V4/Northwind/Northwind.svc/Orders', adaptor:"ODataV4Adaptor" });
this.gridData = this.dataManager; |
Hi,
thanks for the hint on the parameter, i once started with this example:
https://help.syncfusion.com/js/datamanager/data-binding with WebApiAdaptor an in this doc example the adaptor Parameter is not passed as a string. I just modified this starting snipped then.
Unfortunately I get a Cannot find name 'ej' error now.
Fixed the obove error with adding a reference of "@types/ej.web.all" to the types property in the tsconfig.json
Hi,
the ReferenceError: ej is not defined is back but I can't find out where i'm missing a piece.
Error:
restapi-adaptor.ts:6 Uncaught ReferenceError: ej is not defined
at Object.<anonymous> (restapi-adaptor.ts:6)
at __webpack_require__ (bootstrap 6fe175e14e9077501c5f:657)
at fn (bootstrap 6fe175e14e9077501c5f:85)
at Object.<anonymous> (navmenu.component.ts:15)
at __webpack_require__ (bootstrap 6fe175e14e9077501c5f:657)
at fn (bootstrap 6fe175e14e9077501c5f:85)
at Object.<anonymous> (app.module.browser.ts:31)
at __webpack_require__ (bootstrap 6fe175e14e9077501c5f:657)
at fn (bootstrap 6fe175e14e9077501c5f:85)
at Object.<anonymous> (index.js:4)
this is my Code in restapi-adaptor.ts
import { DataManager, ODataV4Adaptor, Query } from '@syncfusion/ej2-data';
export class RestApiAdaptor extends ej.ODataV4Adaptor {
processQuery(dm: ej.DataManager, query: ej.Query, hierarchyFilters?: any): any {
// rewrite query string from orginal adapter
let original = super.processQuery.apply(this, arguments);
console.log(original);
let url = original.url;
url = url.replace('?$count=', '?count=');
url = url.replace('&$count=', '&count=');
url = url.replace('?$skip=', '?skip=');
url = url.replace('&$skip=', '&skip=');
url = url.replace('?$top=', '?top=');
url = url.replace('&$top=', '&top=');
return {
type: original.type,
url: url,
ejPvtData: original.ejPvtData,
contentType: original.contentType,
data: original.data
};
}
}
Fixed again, had to put the EJAngular2Module reference in app.module.shared.ts before the component holding the grid / loading the adaptor.
- 5 Replies
- 2 Participants
-
MS Martin Strojek
- Nov 10, 2017 07:25 AM UTC
- Nov 14, 2017 04:13 AM UTC