Hi All, the post is a bit elaborated..as I want the problem to be understood clearly.Please do reply if anyone knows the solution.Its very important for me to find a solution for this asap.
I am using Smartgwt 2.4 version with GWT 2.3
I have created a SelectItem in a form for which the property setMultiple(boolean) is set to true as per the requirement, so that we can select multiple items from it.
I am saving the data from the SelectItem by getting the selected values using getValues() method which returns all the selected values from the SelectItem.
Saving is fine, however when I try to edit the form I need to get the previously stored values from the database for the SelectItem and display them as checked and do the respective operations depending on whether the item is selected or not.
I could get the data from the Database, but couldn't find any method to set the values to the SelectItem and make them as selected/checked.
Code:
SelectItem testSelectItem= new SelectItem();
testSelectItem.setName("test");
testSelectItem.setTitle("Test");
testSelectItem.setMultiple(true);
testSelectItem.setValueMap(a Map object which contains keys and Values)
Keys are retrieved when we call getValues and Values are displayed in the SelectItem.Hence Keys can be considered as value fields and values can be considered as display fields for the SelectItem.
Now I have a Map which contains the previously selected items in the SelectItem.
Please do let me know how to set only these values as selected in the SelectItem which contains all the items from the valuemap (In brief all the items are in unselected state initially in the SelectItem, among them I want a few items to be in selected/checked state while editing).
I have tried setValues(String[]) String array contains the previously selected values, but it is reassigning the SelectItem to only these values overriding the previously set ValueMap.But I need the items in the String[] to be selected in SelectItem along with the other items of the ValueMap set, which are unselected by default.
If anyone knows the solution, please post it ASAP.
Thanks in advance.
I am using Smartgwt 2.4 version with GWT 2.3
I have created a SelectItem in a form for which the property setMultiple(boolean) is set to true as per the requirement, so that we can select multiple items from it.
I am saving the data from the SelectItem by getting the selected values using getValues() method which returns all the selected values from the SelectItem.
Saving is fine, however when I try to edit the form I need to get the previously stored values from the database for the SelectItem and display them as checked and do the respective operations depending on whether the item is selected or not.
I could get the data from the Database, but couldn't find any method to set the values to the SelectItem and make them as selected/checked.
Code:
SelectItem testSelectItem= new SelectItem();
testSelectItem.setName("test");
testSelectItem.setTitle("Test");
testSelectItem.setMultiple(true);
testSelectItem.setValueMap(a Map object which contains keys and Values)
Keys are retrieved when we call getValues and Values are displayed in the SelectItem.Hence Keys can be considered as value fields and values can be considered as display fields for the SelectItem.
Now I have a Map which contains the previously selected items in the SelectItem.
Please do let me know how to set only these values as selected in the SelectItem which contains all the items from the valuemap (In brief all the items are in unselected state initially in the SelectItem, among them I want a few items to be in selected/checked state while editing).
I have tried setValues(String[]) String array contains the previously selected values, but it is reassigning the SelectItem to only these values overriding the previously set ValueMap.But I need the items in the String[] to be selected in SelectItem along with the other items of the ValueMap set, which are unselected by default.
If anyone knows the solution, please post it ASAP.
Thanks in advance.
Comment