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

4.1 Upgrade issue with getting boolean form record

$
0
0
I have upgraded from 4.0 to 4.1 and since doing that a large number of pages have broken in my application relating to getting boolean values.

In a data source when mapping data anytime getAttributeAsBoolean is called I get an error, what is strange however is...

Code:

listGrid.getSelectedRecord().getAttributeAsObject("email")
returns Boolean = True

However getAttributeAsBoolean() gives an error

Code:

Something other than a Java object was returned from JSNI method '@com.smartgwt.client.core.DataClass::getAttributeAsBoolean(Ljava/lang/String;)': JS value of type boolean, expected java.lang.Object
Now although frustrating, I do have a utility class which I use to grab the boolean values now...

Code:

public static boolean getAttributeAsBoolean(Record record, String attributeName) {
        if (record.getAttributeAsObject(attributeName) instanceof Boolean) {
                return BooleanUtils.isTrue((Boolean)record.getAttributeAsObject(attributeName));
        } else if (record.getAttributeAsObject(attributeName) instanceof String) {
                return Boolean.parseBoolean(record.getAttribute(attributeName));
        }
        return false;
}


First, just to confirm, this is a bug right and not expected behavior? Is there workaround or will I need to wait for nightly build with this fixed?

Thanks,
Dale

GWT Version : 2.4.0
SmartGWT Version : 4.1p
SmartGWT Build Date : 03/08/2014 06:16

Viewing all articles
Browse latest Browse all 4756

Trending Articles