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
Hi Jamie,
Thanks, that's great and in-depth feedback! :) I just checked the latest code, and it looks like this issue has already been fixed:
len = data ? data.length : 0;
This is the latest version of this line. You can use it, until the fix is officially available - i am not sure which version you're using, it may be already in the latest update.
Thanks again,
Angel
As Angel mentioned, I just checked and this fix is in place for our latest service release of Ignite UI 2012 Vol. 2. The build number for this service release is 12.2.20122.2056.
This service release is available under your account at the Infragistics Website. To download the service release, log in to ‘Account’ and select ‘Keys & Downloads’. Select the NetAdvantage tab and then click on the product name. Finally, select the 'Service Releases' tab and the available service releases will be listed below.
Please let us know if you have any further questions or concerns about this matter.