smartgwt 在 ComboBoxItem 中添加空白行或允许用户设置空白值
smartgwt add blank row in ComboBoxItem or allow user to set blank value
我正在尝试在 smartgwt
的 ComboBoxItem 中添加具有 null 值的空白行,它已经绑定到来自数据库的数据源。
服务层、控制器层、数据库我也试过改,但学长不推荐
我只需要在 UI layer
上进行更改。
查看 Special Values ComboBox SmartGWT 展示演示。我认为它可以满足您的需求。
这里是摘自该演示代码的摘录(尽管我建议您查看它并研究代码以了解最适合您的情况):
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(ItemSupplyXmlDS.getInstance());
comboBoxItem.setDisplayField("itemName");
comboBoxItem.setValueField("itemID");
comboBoxItem.setPickListWidth(300);
comboBoxItem.setPickListFields(skuField, itemNameField);
comboBoxItem.setSpecialValues(hashMap);
comboBoxItem.setSeparateSpecialValues(true);
我正在尝试在 smartgwt
的 ComboBoxItem 中添加具有 null 值的空白行,它已经绑定到来自数据库的数据源。
服务层、控制器层、数据库我也试过改,但学长不推荐
我只需要在 UI layer
上进行更改。
查看 Special Values ComboBox SmartGWT 展示演示。我认为它可以满足您的需求。
这里是摘自该演示代码的摘录(尽管我建议您查看它并研究代码以了解最适合您的情况):
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(ItemSupplyXmlDS.getInstance());
comboBoxItem.setDisplayField("itemName");
comboBoxItem.setValueField("itemID");
comboBoxItem.setPickListWidth(300);
comboBoxItem.setPickListFields(skuField, itemNameField);
comboBoxItem.setSpecialValues(hashMap);
comboBoxItem.setSeparateSpecialValues(true);