3.2.0

data[...] is null or not an object

I get this error if I sort a column, and then repopulate the grid.
I am storing my data in a javascript array, and have a getCellValue() function setup to access the array elements.

Using a javascript debugger, I seem to have narrowed it down to a call to my getCellText(i,j) function. On the first column of the second row j is being passed in as undefined.

This only happens if I sort prior to repopulating. If I never use sort, the problem does not occur.

Any ideas?
Raf
February 6,
Found a workaround.

Seems sort was holding some sort of state regarding the resultsize, so next time I searched it was using that state??

Fix was to do:
obj.clearRowModel();

The side effect of that, being that the sort was not applied to the newly populated data. So to resolve that I capture the currently sorted row prior to the refresh, and set it again after. So my entire code for that is:
data = newRows;
var sortColumn = obj.getSortColumn();
var sortDirection = obj.getSortDirection(sortColumn);
obj.clearRowModel();
obj.setRowCount(newRows.length);
window.setTimeout('obj.refresh()',100);
// reinstate sorting
if (sortColumn != -1) {
obj.sort(sortColumn, sortDirection);
}

Hope this helps someone else.
Raf
February 6,

This topic is archived.

See also:


Back to support forum