Smartgwt selectitem key value issue

可紊 提交于 2019-12-03 22:53:24

问题


I have a SelectItem which I fill through a Map that has this combo is within a listgridfield, so good up there, but when I select any item in the combobox instead of get the description or value of the map puts the key in the listgridfield.

How I can do to make me set the value instead of key? now I tried to do with AddChangeHandler but has not worked.

I got the next code:

final ListGridField measureField = new ListGridField(CdmsConstants.MEASURE_ABB,    CdmsConstants.CMB_MEASURE_TITULO, 100);

final SelectItem measureComboBox = new SelectItem();
measureComboBox.setDefaultToFirstOption(false);
measureComboBox.setName(CdmsConstants.MEASURE_ABB);
measureComboBox.setTitle(CdmsConstants.CMB_MEASURE_TITULO);
measureComboBox.setDefaultValues(CdmsConstants.CMB_DEFAULT_VALUE);
measureComboBox.setType("comboBox");
measureComboBox.setVisible(true);
measureComboBox.setValueMap(result);
measureComboBox.setValidateOnExit(true);

measureField.setEditorType(measureComboBox);

In the measureComboBox When i put the variable result (that is a Map) and click to any item of the combo the value that shows into the combo box is the key of the linckedhashmap and no the value of the item... how can i make to change this?

Thanks a lot.


回答1:


If you use a datasource instead of LinkedHashMap, then you can use setValueField method of SelectItem instance. but in this case MAY you can use setValueFormatter method of your SelectItem object.




回答2:


I had the same/similar problem, my solution that can be seen here ListGrid.setEditorCustomizer in SmartGWT was to use a datasource for the SelectItem and then implemented my own CellFormatter



来源:https://stackoverflow.com/questions/10492319/smartgwt-selectitem-key-value-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!