In our application we use a lot of SelectItems which can contain a lot of data. This is why they are paged, to further limit the result we also include some default filtering, but this should be clearable by the user.
This however gives some problem when setAllowEmptyValue is set to true. It is a bit inconsistent to determine when the empty value is shown. For example when you first open the selectitem the empty value is shown, but when clearing this default filter the empty value is not shown. For us it would be ideal if the empty value was shown regardless of what the selectitem was filtered on.
We have a similar problem that the empty value is not shown when you open the selectitem initially, but it is shown when you open it the second time. However at the moment we have not been able to create a testcase for this.
This was tested with GWT 2.1.0 with SmartGwt Power 3.0 (SmartClient Version: v8.2p_2012-05-02/PowerEdition Deployment (built 2012-05-02)) on Firefox 10
Datasource:
This however gives some problem when setAllowEmptyValue is set to true. It is a bit inconsistent to determine when the empty value is shown. For example when you first open the selectitem the empty value is shown, but when clearing this default filter the empty value is not shown. For us it would be ideal if the empty value was shown regardless of what the selectitem was filtered on.
We have a similar problem that the empty value is not shown when you open the selectitem initially, but it is shown when you open it the second time. However at the moment we have not been able to create a testcase for this.
This was tested with GWT 2.1.0 with SmartGwt Power 3.0 (SmartClient Version: v8.2p_2012-05-02/PowerEdition Deployment (built 2012-05-02)) on Firefox 10
Code:
package test.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.FetchMode; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.SelectItem; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; public class AllowEmptyValueTest implements EntryPoint { public void onModuleLoad() { SelectItem item = new SelectItem("test", "test"); item.setOptionDataSource(DataSource.get("location")); item.setValueField("lctn_pk"); item.setDisplayField("lctn_name");; ListGrid listGridProperties = new ListGrid(); listGridProperties.setShowFilterEditor(true); listGridProperties.setShowHeader(true); listGridProperties.setCanEdit(false); listGridProperties.setCanResizeFields(true); listGridProperties.setFetchDelay(1000); listGridProperties.setDataFetchMode(FetchMode.PAGED); item.setAllowEmptyValue(true); item.setAutoFetchData(false); item.setPickListFields(new ListGridField("lctn_name", "name")); item.setPickListProperties(listGridProperties); DynamicForm form = new DynamicForm(); form.setFields(item); form.draw(); } }
Code:
<DataSource ID="location" serverType="sql" tableName="location"> <fields> <field primaryKey="true" type="sequence" name="lctn_pk" hidden="true"></field> <field type="text" length="45" name="lctn_name" title="" required="true" canFilter="true" export="true"></field> </fields> </DataSource>
Comment