This code crashes if you call addData(new Record()) followed by getRecords() on a setSaveLocally(true) listGrid. The cast is unneccesarily specific (it would be fine if it was (Record).
Fix - use ListGridRecord instead.
Fix - use ListGridRecord instead.
Code:
private static ListGridRecord[] convertToListGridRecordArray(JavaScriptObject nativeArray) {
if (nativeArray == null) {
return new ListGridRecord[]{};
}
JavaScriptObject[] componentsj = JSOHelper.toArray(nativeArray);
ListGridRecord[] objects = new ListGridRecord[componentsj.length];
for (int i = 0; i < componentsj.length; i++) {
JavaScriptObject componentJS = componentsj[i];
ListGridRecord obj = (ListGridRecord) RefDataClass.getRef(componentJS);
if (obj == null) obj = new ListGridRecord(componentJS);
objects[i] = obj;
}
return objects;
}
Comment