I have a SelectItem that is behaving differently after upgrading to SmartGWT 5.0p.
The previous 4.1p would show the empty value in the drop down to select showing the configured display value of "--NONE--". In 5.0p this selection is not there so once you select an item in the list, there is no way to select an empty or no value.
Attached are screen shots of it working in 4.1 and then the same code compiled with 5.0.
Code levels used:
SmartClient Version: v9.1p_2015-02-07/Pro Deployment (built 2015-02-07)
SmartClient Version: v10.0p_2015-05-07/Pro Deployment (built 2015-05-07)
Here is the code to reproduce it:
The previous 4.1p would show the empty value in the drop down to select showing the configured display value of "--NONE--". In 5.0p this selection is not there so once you select an item in the list, there is no way to select an empty or no value.
Attached are screen shots of it working in 4.1 and then the same code compiled with 5.0.
Code levels used:
SmartClient Version: v9.1p_2015-02-07/Pro Deployment (built 2015-02-07)
SmartClient Version: v10.0p_2015-05-07/Pro Deployment (built 2015-05-07)
Here is the code to reproduce it:
Code:
public class Sandbox1 implements EntryPoint { private static final String ID = "id"; private static final String PINNED = "pinned"; private static final String VISIBILITY = "visibility"; private static final String NAME = "name"; private ListGridRecord[] cacheData = new ListGridRecord[3]; private DataSource dataSource; private SelectItem selectList; @Override public void onModuleLoad() { int i = 0; cacheData[i] = new ListGridRecord(); cacheData[i].setAttribute(ID, i); cacheData[i].setAttribute(NAME, "abc"); cacheData[i].setAttribute(VISIBILITY, "Me"); cacheData[i].setAttribute(PINNED, false); i++; cacheData[i] = new ListGridRecord(); cacheData[i].setAttribute(ID, i); cacheData[i].setAttribute(NAME, "lmn"); cacheData[i].setAttribute(VISIBILITY, "Group"); cacheData[i].setAttribute(PINNED, false); i++; cacheData[i] = new ListGridRecord(); cacheData[i].setAttribute(ID, i); cacheData[i].setAttribute(NAME, "xyz"); cacheData[i].setAttribute(VISIBILITY, "Everyone"); cacheData[i].setAttribute(PINNED, false); final VLayout appLayout = new VLayout(); appLayout.setWidth100(); appLayout.setHeight100(); createDataSource(); createSelectList(); loadData(); appLayout.setMargin(5); appLayout.setMembersMargin(5); DynamicForm form = new DynamicForm(); form.setItems(selectList); appLayout.addMembers(form); appLayout.draw(); } private void createDataSource() { dataSource = new DataSource(); DataSourceField filterIdField = new DataSourceField(ID, FieldType.TEXT, "ID"); filterIdField.setPrimaryKey(true); DataSourceField filterNameField = new DataSourceField(NAME, FieldType.TEXT, "Name"); DataSourceField visibilityField = new DataSourceField(VISIBILITY, FieldType.TEXT, "Visible To"); DataSourceField pinnedField = new DataSourceField(PINNED, FieldType.BOOLEAN, "Pinned"); dataSource.setFields(filterIdField, filterNameField, visibilityField, pinnedField); dataSource.setClientOnly(true); } private void createSelectList() { selectList = new SelectItem("test"); selectList.setWidth(300); selectList.setAllowEmptyValue(Boolean.TRUE); selectList.setEmptyDisplayValue("-- NONE --"); selectList.setOptionDataSource(dataSource); selectList.setTitle("Test"); selectList.setFilterLocally(Boolean.TRUE); selectList.setCachePickListResults(Boolean.FALSE); ListGridField filterNameField = new ListGridField(NAME); filterNameField.setShowHover(Boolean.TRUE); ListGridField visibilityField = new ListGridField(VISIBILITY); ListGridField pinnedField = new ListGridField(PINNED); selectList.setPickListFields(filterNameField, visibilityField, pinnedField); selectList.setValueField(ID); selectList.setDisplayField(NAME); selectList.setSortField(NAME); selectList.setPrompt("Select Filter to use"); selectList.setShowTitle(Boolean.FALSE); selectList.setWrapTitle(Boolean.FALSE); } public void loadData() { dataSource.setCacheData(cacheData); } }
Comment