Be sure your post includes:
1. SmartClient Version: v8.3p_2013-05-22/LGPL Development Only (built 2013-05-22)
2. Firefox 3.6.17
3.
4.
5.
6.
When Datasource definition includes more than one foreign key field, then PickTreeItem creating Criteria request uses (I guess) the first foreign field listed in ds.
Expanding PickTreeItem produces the following request:
According to the docs for the Tree.setParentIdField(), the default field name for parent is "parentId". This is working fine in TreeGrid, but not in PickTreeItem as shown in above test case.
Also, I can't find a way to explicit set parent field for PickTreeItem (for TreeGrid, setDataProperties() and Tree template can be used).
MichalG
1. SmartClient Version: v8.3p_2013-05-22/LGPL Development Only (built 2013-05-22)
2. Firefox 3.6.17
3.
4.
5.
6.
Code:
package pl.com.tech4.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.DOM; import com.smartgwt.client.data.DataSourceField; import com.smartgwt.client.data.OperationBinding; import com.smartgwt.client.data.RestDataSource; import com.smartgwt.client.types.DSDataFormat; import com.smartgwt.client.types.DSOperationType; import com.smartgwt.client.types.DSProtocol; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.PickTreeItem; public class MainEntryPoint implements EntryPoint { public void onModuleLoad() { DOM.getElementById("loadingPicture").removeFromParent(); layout(); SC.showConsole(); } private void layout() { RestDataSource ds = new RestDataSource(); OperationBinding fetchBinding = new OperationBinding(); fetchBinding.setOperationType(DSOperationType.FETCH); fetchBinding.setDataFormat(DSDataFormat.XML); fetchBinding.setDataProtocol(DSProtocol.POSTXML); ds.setOperationBindings(fetchBinding); DataSourceField fieldId = new DataSourceField(); fieldId.setName("id"); fieldId.setPrimaryKey(true); DataSourceField fieldTestId = new DataSourceField(); fieldTestId.setName("testId"); fieldTestId.setForeignKey("id"); DataSourceField fieldParentId = new DataSourceField(); fieldParentId.setName("parentId"); fieldParentId.setForeignKey("id"); ds.setFields(fieldId, fieldTestId, fieldParentId); PickTreeItem parentIdItem = new PickTreeItem("parentId"); parentIdItem.setEmptyDisplayValue("A bug?"); parentIdItem.setDataSource(ds); DynamicForm df = new DynamicForm(); df.setFields(parentIdItem); df.setDataSource(ds); df.draw(); } }
Expanding PickTreeItem produces the following request:
Code:
<request> <data> <testId xsi:nil="true"/> </data> <dataSource>isc_RestDataSource_0</dataSource> <operationType>fetch</operationType> <oldValues></oldValues> </request>
Also, I can't find a way to explicit set parent field for PickTreeItem (for TreeGrid, setDataProperties() and Tree template can be used).
MichalG
Comment