Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

ListGridRecord setAttribute with List

$
0
0
Hi,
I was using SmartGwt 3.1 up to about two weeks ago, and I have a code generator that creates ListGridRecord objects from many types of DTOs in my application. Some of these DTOs contained List<> and Set<> objects. The code generator would do this on the ListGridRecord object:

Code:

this.setAttribute( ATTRIBUTES.CONFIGJOBS.toString(), dto.getConfigJobs() );
where dto.getConfigJobs() returns a List<ConfigJobDTO>

This was working fine with SmartGWT 2.5 and 3.1.

After the upgrade to 4.0, I got this error when calling setAttribute() with the List<> as a parameter:

Code:

java.lang.UnsupportedOperationException: Can not convert element 0 of the array to a JavaScriptObject. Instances of class `com.test.ListDTO' can not automatically be converted. Please see the SmartClient documentation of RPCRequest.data for a table of Java types that can be converted automatically.
Now I found a workaround doing this instead:

Code:

com.smartgwt.client.util.JSOHelper.setObjectAttribute(this.getJsObj(),ATTRIBUTES.CONFIGJOBS.toString(), dto.getConfigJobs() );
I was wondering if there was an explanation to why this behavior has changed, and is this a safe way of putting a List of objects into a ListGridRecord attribute ?

I am using Firefox and Chrome and both have the same behavior.

Thank you

Viewing all articles
Browse latest Browse all 4756

Trending Articles