Hi,
I've been logging editedRecord before doing setData, and after response.getDate (but still before processResponse) and I've seen that my record is not the same after using response.getData() !
I've changed Record.convertToRecordArray() into the following and this solves "the difference". Can anyone explain (why would I 'sometimes' need to go getRef and sometimes not?) and maybe solve this if this is indeed a bug?
cheers,
I've been logging editedRecord before doing setData, and after response.getDate (but still before processResponse) and I've seen that my record is not the same after using response.getData() !
Code:
//log editedRecord here
response.setData(new Record[]{editedRecord});
//log response.getData() here
processResponse(requestId, response);
Code:
public static Record[] convertToRecordArray(JavaScriptObject nativeArray) {
if (nativeArray == null) {
return new Record[]{};
}
if (JSOHelper.isArray(nativeArray)) {
JavaScriptObject[] componentsj = JSOHelper.toArray(nativeArray);
Record[] objects = new Record[componentsj.length];
for (int i = 0; i < componentsj.length; i++) {
JavaScriptObject componentJS = componentsj[i];
//change this:
//Record obj = (Record) RefDataClass.getRef(componentJS);
//into:
Record obj = new Record(componentJS);
if (obj == null) obj = new Record(componentJS);
objects[i] = obj;
}
return objects;
} else {
Record[] ret = new Record[1];
ret[0] = Record.getOrCreateRef(nativeArray);
return ret;
}
}
cheers,
Comment