Originally posted by banuk77
Announcement
Collapse
No announcement yet.
X
-
The groups SelectItem have successfully populated from optionDataSource groupsDS,
What I am trying to figure out now is reading the groups value as array of group from the UserDS, and that values have to be selected on the SelectItem.
how this should be defined in response XML, and how to read that value as array of group.
Thank you
Leave a comment:
-
What I have done so far is,
created a SelectItem that is assigned to a editorForm(DynamicForm)
and set the following
for the groupsDSCode:SelectItem groups = new SelectItem("groups", "Groups"); groups.setMultiple(true); groups.setOptionDataSource(groupsDS); groups.setValueField("groupID"); groups.setDisplayField("displayName");
and the groups.js isCode:DataSource groupDS = new DataSource(); groupDS.setDataFormat(DSDataFormat.JSON); groupDS.setDataURL("data/json/groups.js"); DataSourceField groupID = new DataSourceField("groupID", FieldType.TEXT); DataSourceField groupDisplayName = new DataSourceField("displayName", FieldType.TEXT); groupID.setPrimaryKey(true); groupID.setRequired(true); groupDS.setFields(groupID,groupDisplayName);
For editorFormCode:[ { displayName:"People", groupID:"people", description:"more general group for people", notes:"These are people" }, { displayName:"Server", groupID:"server", description:"Sever Computers", notes:"these are servers" } ]
Where userDS is the UserDataSource, Defined asCode:editorForm = new DynamicForm(); editorForm.setDataSource(userDS); editorForm.setUseAllDataSourceFields(true); editorForm.setFields(groups);
a sample UserData as followsCode:RestDataSource userDS = new RestDataSource() { @Override protected Object transformRequest(DSRequest dsRequest) { return super.transformRequest(dsRequest); } @Override protected void transformResponse(DSResponse response, DSRequest request, Object data) { super.transformResponse(response, request, data); } }; DataSourceField groups = new DataSourceField("groups", FieldType.ENUM, "Groups"); userDS.setFields(groups); userDS.setFetchDataURL("data/xml/responses/user_fetch_rest.xml");
Can anyone please tell me am I on the right Track,Code:<response> <status>0</status> <startRow>0</startRow> <endRow>0</endRow> <totalRows>1</totalRows> <data> <record> <firstName>Banu</firstName> <userID>banu</userID> <groups> <group> <groupID>router</groupID> </group> <group> <groupID>server</groupID> </group> </groups> </record>
What xPath value I need to give for the groups to get them as an array of group.
When I comple and run I didnt get any errors, But the groups Field is empty.
Thank youLast edited by banuk77; 2 Aug 2010, 23:00.
Leave a comment:
-
DataSource Multiple Select Item
Hi, I am new to SmartGWT, and trying to create an Interface to edit a <User> table that has a Field called <Groups>. The available groups are supplied with GroupsDS and the User Records through UserDS. Now, I need to Have the groups field of the User Record as multi Selectable, and its valueMap have to be populated with the Values of GroupsDS.
and in the User record editing, the groups that the user has assigned, have to be selected in the multiSelect SelectItem(groups).
How can I achieve this?
Thank youTags: None
Leave a comment: