1. SmartGWT.mobile 1.0
2. Browser: Chromium 17.0.963.83
3. Eclipse IDE 3.7.2 - Google Plugin for Eclipse 2.5.2
Problem #1 - Missing metaDataPrefix on requests
If you read the user_guide.txt of SmartGWT.mobile you'll find the following statement:
If you then refer to the RestDataSource of SmartGWT (http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/data/RestDataSource.html) you'll find the following:
If the SmartGWT.mobile behaves like a RestDataSource you should be able to define the sendMetaData flag and the metadata should have the default prefix. Instead the metadata is sent without the prefix.
Steps to reproduce:
* Check the online demo: http://smartgwt-mobile.smartclient.com/
* Go to: Data Binding > Table View (Check the request to the server),
* The metadata parameters should be prefixed with "_", so "_operationType" instead the request goes with "operationType".
Checking the Java implementation you'll find:
Problem # 2 - Exception when data returned contains a null value - Bug in: JSONUtils.getPropertyType
If the data array on a server response contains a record, and the value of one of the properties it's null the operation fails with:
Checking the implementation of JSONUtils.getPropertyType:
Sample of response that will make the operation fail:
Thanks,
Ivan
2. Browser: Chromium 17.0.963.83
3. Eclipse IDE 3.7.2 - Google Plugin for Eclipse 2.5.2
Problem #1 - Missing metaDataPrefix on requests
If you read the user_guide.txt of SmartGWT.mobile you'll find the following statement:
"Specifically, the DataSource implementation in SmartGWT.mobile behaves like a RestDataSource with dataFormat:"json"."
If sendMetaData is true, the DSRequest meta data properties will also be present as parameters, prefixed with metaDataPrefix.
Example URL constructed with the metaDataPrefix set to "_" (the default):
[dataURL]?field1=value1&_operationType=fetch&_startRow=0&_endRow=50&_sortBy=-field2&_dataSource=dsName
In this case the server would be able to separate the request's data from the meta data via the "_" prefix.
Example URL constructed with the metaDataPrefix set to "_" (the default):
[dataURL]?field1=value1&_operationType=fetch&_startRow=0&_endRow=50&_sortBy=-field2&_dataSource=dsName
In this case the server would be able to separate the request's data from the meta data via the "_" prefix.
Steps to reproduce:
* Check the online demo: http://smartgwt-mobile.smartclient.com/
* Go to: Data Binding > Table View (Check the request to the server),
Code:
{ operationType: "fetch", dataSource: "continentsDS", requestId: 2, startRow: 0, endRow: 1 }
Checking the Java implementation you'll find:
Code:
@SuppressWarnings("unchecked") private void performDSOperation(String opType, Record data, DSCallback callback, DSRequest props) { // Form a DSRequest DSRequest dsRequest = new DSRequest(); dsRequest.put("operationType", opType); // <-- this should be configurable? dsRequest.put("dataSource", this.get("ID")); dsRequest.put("data", data); dsRequest.put("callback", callback); dsRequest.put("requestId", _getNextRequestId()); if (props != null) dsRequest.putAll(props); // Declined to implement a ton of involved sort logic here... sendDSRequest(dsRequest); }
Problem # 2 - Exception when data returned contains a null value - Bug in: JSONUtils.getPropertyType
If the data array on a server response contains a record, and the value of one of the properties it's null the operation fails with:
Code:
com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot read property 'constructor' of null
Code:
public static native String getPropertyType(JavaScriptObject jso, String keyName) /*-{ var value = jso[keyName]; var type = typeof value; if (type == 'object') { // <--- Here you need to check if is null since: typeof null === 'object' // (... some code) } // (... some code) return type; }-*/;
Code:
{ response: { status: 0, startRow: 0, endRow: 0, totalRows: 1, data: [{ field1: null, field2: "value" }] } }
Ivan
Comment