我试图添加空行null ComboBoxItem中的值smartgwt
它已绑定到来自数据库的数据源。smartgwt在ComboBoxItem中添加空白行或允许用户设置空白值
我已经尝试过服务层,控制器层和数据库的更改,但这并不是我的老大推荐的。
我只需要对UI layer
进行更改。
我试图添加空行null ComboBoxItem中的值smartgwt
它已绑定到来自数据库的数据源。smartgwt在ComboBoxItem中添加空白行或允许用户设置空白值
我已经尝试过服务层,控制器层和数据库的更改,但这并不是我的老大推荐的。
我只需要对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);
嘿@carlossierra,你的解决方案似乎是为我工作。但在我的smartgwt这些方法setSpecialValues(LinkedHashMap
我对v3.0p不是很熟悉,但我想这可能是真的。你不能升级到最新版本吗? – carlossierra
嗨@carlossierra,_此功能版本6.0_。我与团队讨论过。不,我们无法升级到最新版本。再次停留在起始位置。有没有其他方式可以操纵数据源或通过其他方式。 – Amolb
“不能共享代码” ?真?你完全无法想出一个能够证明你的问题的[mcve]吗?如果是这样,那么你真的不能指望任何人提出一个答案,可以吗? –
@TobySpeight对这个家伙不那么难。我不认为需要代码来正确回答这个问题,因为它是一个通用的'如何做'的问题,而不是'我的代码有什么问题'。 – carlossierra