Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
725
igGrid + REST JSON data = Null Reference
posted

Hey guys,

I think I've found a bug in one of your .js files.  When I try to bind my grid to a REST service (which returns its data in JSON format), I get the following error:

Microsoft JScript runtime error: Unable to get value of the property 'length': object is null or undefined

If I break at that point, it breaks on the following statement:

var x, len = data.length;

(It is the first statement to run inside of the "_successCallback: function (data) {" function, which starts at line 28776 of infragistics.js, in the section with "Infragistics.Web.ClientUI Data Binding Plugin 12.2.20122.1021" in its header.) 

Upon inspecting the data object, I see that it is null.  The reason that I suspect there's a bug is because the very next statement does a check to see if data is null:

if ((data === undefined || data === null) && !this._alreadySet)

In the case that data is null, it'll never get to the if statement, because it will have thrown an exception in the previous statement.

 

In my debugging, if I break "len = data.length" onto its own line and skip over it, everything else runs just fine, and my grid seems to render properly. 

Ultimately, I'd like to know if it's okay for me to just wrap the "len = data.length" inside of an "if (data != null)"?  And if I am allowed to do that, can I set len to 0 in the "else" case?

 

(If you NEED a sample in order to reproduce, I can try to put one together for you, but the project I'm running has a lot of pages/controls/services/js, so it would take me a while to put it together.  I'm hoping that the logic of checking for null after already using the object is enough to determine whether there's an inherent problem there or not.)

Thanks!

Jamie

Parents
  • 85
    posted

    Hi Jamie,

    Is your problem solved related to the grid with Rest service.

    I am also running into same problem, some time errors are coming if i try to solve those problems grid is not rendering with data. But i found data is coming to jquery functions. If possible, please provide your example i will check what's wrong going in my code.

    My requirement is to generate grid with Java RESTful webservice which returns data in JSON format.

     

    Regards

    Sekhar.

     

     

     

Reply Children
No Data