Problem with ComboBoxItem and SpecialValues
I am experiencing two problems.
1. When two different comboboxes on seperate forms share the same datasource.. they try and share the same special values even if its only set up on one of the comboboxes.
2. Setting setDefaultValue() to one of the “special” options works .. but when dropping down the combobox the first non-special value appears highlighted.
I have demonstrated these in the included test case -
Try dropping down the first combobox and then the second - the special values render at the very top of the screen.
When dropping down the second combobox and then the first - the special values appear in the first combobox as well !
The second combo has a default value set but when dropping it down it is not highlighted/selected in the picklist- the first normal value is instead.
The file is designed to just overwrite the BuiltInDS.java file in the BuiltInDS sample and work with no other changes.
Code:
My version is: v10.0p_2014-10-07/Pro Deployment (built 2014-10-07)
Thank-you very much in advance.
I am experiencing two problems.
1. When two different comboboxes on seperate forms share the same datasource.. they try and share the same special values even if its only set up on one of the comboboxes.
2. Setting setDefaultValue() to one of the “special” options works .. but when dropping down the combobox the first non-special value appears highlighted.
I have demonstrated these in the included test case -
Try dropping down the first combobox and then the second - the special values render at the very top of the screen.
When dropping down the second combobox and then the first - the special values appear in the first combobox as well !
The second combo has a default value set but when dropping it down it is not highlighted/selected in the picklist- the first normal value is instead.
The file is designed to just overwrite the BuiltInDS.java file in the BuiltInDS sample and work with no other changes.
Code:
Code:
package com.smartgwt.sample.client; import java.util.LinkedHashMap; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.ComboBoxItem; import com.smartgwt.client.widgets.layout.HLayout; public class BuiltInDS implements EntryPoint { @Override public void onModuleLoad() { DynamicForm form = new DynamicForm(); form.setWidth(400); ComboBoxItem combo1 = new ComboBoxItem(); combo1.setOptionDataSource(DataSource.get("supplyItem")); combo1.setDisplayField("itemName"); combo1.setValueField("itemID"); combo1.setName("filteredSelect"); combo1.setTitle("Choose an item (Select)"); form.setFields(combo1); DynamicForm form2 = new DynamicForm(); form2.setWidth(400); LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>(); hashMap.put("**EmptyValue**", "None"); hashMap.put("-1", "Not Applicable"); ComboBoxItem comboBoxItem = new ComboBoxItem(); comboBoxItem.setName("filteredCombo"); comboBoxItem.setTitle("Choose an item (ComboBox)"); comboBoxItem.setAddUnknownValues(false); comboBoxItem.setOptionDataSource(DataSource.get("supplyItem")); comboBoxItem.setDisplayField("itemName"); comboBoxItem.setValueField("itemID"); comboBoxItem.setSpecialValues(hashMap); comboBoxItem.setSeparateSpecialValues(true); comboBoxItem.setDefaultValue("**EmptyValue**"); form2.setFields(comboBoxItem); HLayout hLayout = new HLayout(); hLayout.addMember(new Label(com.smartgwt.client.Version.getSCVersionNumber())); hLayout.addMember(form); hLayout.addMember(form2); hLayout.draw(); } }
Thank-you very much in advance.
Comment