When I call my page to grab my JSON data and it returns records I can call data in the object or grid.
If the JSON comes back with no data and I try to add records and reference I get a null reference error on either the grid or the js object.
Is there a way to initialize the variable to that is no initial JSON comes back then it will not be null. It seems that igGrid can't add data if no initial rows come back.
Hi Donnie,
Which method are you using to add records to the grid?
Are you trying to change the data source after the grid is created?
Thanks in advance,
Martin Pavlov
Infragistics, Inc.
I am using an AJAX call to a C# method. I use JsonWriter to build a JSON string and return it.
I am initializing my JS variable as var GridDate. If the AJAX call returns something the string get populated.
I am called this in the $.ig.loader
var json = (function () {
$.ajax({ 'async': false, 'global': false, 'url': (SitePath + "Timesheet/GridData.aspx?tsid=<%=tsid%>"), 'dataType': "json", 'success': function (data) { gridData = data; } }); return json; })();
$("#TSDefaultGrid").igGrid({ dataSource: gridData });
As you see gridDate get the JSON return. Maybe try to put something in my gridData variable if nothing is returned? Or initialize the variable to the schema of my JSON?