We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Cannot read property result of undefined

When trying to create a Grid, I get an error in the Javascript and it doesn't load any data.  It says Cannot read property result of undefined.  This error is in the ODataAdapter.processResponse function.  It has an argument i which is the OData response from my server, but then it tries to read property d from object i.  The error occurs on this line (from the .min.js file: 

var p = u._requiresCount ? i.d.result : i.d, l, a, b, nt, k, tt, g, h;

This seems like a typo, or a problem with minification, since the OData response clearly doesn't contain the property d.

1 Reply

GV Gowthami V Syncfusion Team August 24, 2015 02:06 PM UTC

Hi David,

Thanks for using Syncfusion products.

We have analyzed the reported issue and considered this requirement “Script error thrown when the response in light format in OData adaptor” as bug and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.


We can resolve the above issue by using a custom adaptor which is extended from ODataAdaptor and for accessing the light format data in the processResponse of the CustomAdaptor as follows.



$(function(){

        var customAdaptor = new ej.ODataAdaptor().extend({

            processResponse: function(data){

                var result = data["value"];

                var count = data["odata.count"];

                return count == null ? result : { result: result, count: count};

            }

        });

function load(args) {

this.model.dataSource.adaptor = new adaptor();

}

});


@(Html.EJ().Grid<object>("FlatGrid")

. . . .

}).ClientSideEvents(eve => { eve.Load("load"); })


)




Please refer the below link for more clarification about the CustomAdaptors.

http://help.syncfusion.com/ug/aspnetmvc/index.html#!Documents/dataadaptors.htm



Regards,


Gowthami V.


Loader.
Live Chat Icon For mobile
Up arrow icon