Hi,
Docs says that FilterBuilder is using editor type according to the Datasource type. I explicitly set field.setEditorType to ComboBoxItem as in code below.
What I want is a drop down list of already entered values in the "continent" field.
Although this works in grid row editing mode and in grid filter, it does not work in FilterBuilder.
When choosing "continent" field in the FilterBuilder type of value is changed to the ComboBox but drop down list is empty.
Does FilterBuilder support ComboBoxItem filled by this.DataSource ?
Docs says that FilterBuilder is using editor type according to the Datasource type. I explicitly set field.setEditorType to ComboBoxItem as in code below.
What I want is a drop down list of already entered values in the "continent" field.
Although this works in grid row editing mode and in grid filter, it does not work in FilterBuilder.
When choosing "continent" field in the FilterBuilder type of value is changed to the ComboBox but drop down list is empty.
Does FilterBuilder support ComboBoxItem filled by this.DataSource ?
Code:
/* * MainEntryPoint.java * * Created on 1 październik 2009, 17:12 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package org.yournamehere.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.fields.DataSourceBooleanField; import com.smartgwt.client.data.fields.DataSourceDateField; import com.smartgwt.client.data.fields.DataSourceFloatField; import com.smartgwt.client.data.fields.DataSourceIntegerField; import com.smartgwt.client.data.fields.DataSourceTextField; import com.smartgwt.client.types.DSDataFormat; import com.smartgwt.client.types.ListGridEditEvent; import com.smartgwt.client.widgets.form.FilterBuilder; import com.smartgwt.client.widgets.form.fields.ComboBoxItem; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.layout.VLayout; /** * * @author michalg */ public class MainEntryPoint implements EntryPoint { /** Creates a new instance of MainEntryPoint */ public MainEntryPoint() { } /** * The entry point method, called automatically by loading a module * that declares an implementing class as an entry-point */ public void onModuleLoad() { DataSource ds = new DataSource(); ds.setDataFormat(DSDataFormat.XML); ds.setRecordXPath("/List/country"); ds.setDataURL("data.xml"); DataSourceIntegerField pkField = new DataSourceIntegerField("pk"); pkField.setHidden(true); pkField.setPrimaryKey(true); DataSourceTextField countryCodeField = new DataSourceTextField("countryCode", "Code"); countryCodeField.setRequired(true); DataSourceTextField countryNameField = new DataSourceTextField("countryName", "Country"); countryNameField.setRequired(true); DataSourceTextField capitalField = new DataSourceTextField("capital", "Capital"); DataSourceTextField governmentField = new DataSourceTextField("government", "Government", 500); DataSourceBooleanField memberG8Field = new DataSourceBooleanField("member_g8", "G8"); DataSourceTextField continentField = new DataSourceTextField("continent", "Continent"); //continentField.setValueMap("Europe", "Asia", "North America", "Australia/Oceania", "South America", "Africa"); ComboBoxItem comboBoxItem = new ComboBoxItem("continent"); continentField.setEditorType(comboBoxItem); DataSourceDateField independenceField = new DataSourceDateField("independence", "Nationhood"); DataSourceFloatField areaField = new DataSourceFloatField("area", "Area (km²)"); DataSourceIntegerField populationField = new DataSourceIntegerField("population", "Population"); DataSourceFloatField gdpField = new DataSourceFloatField("gdp", "GDP ($M)"); ds.setFields(pkField, countryCodeField, countryNameField, capitalField, governmentField, memberG8Field, continentField, independenceField, areaField, populationField, gdpField); FilterBuilder filterBuilder = new FilterBuilder(); filterBuilder.setDataSource(ds); ListGrid grid = new ListGrid(); grid.setDataSource(ds); grid.setAutoFetchData(true); grid.setWidth(550); grid.setHeight(224); grid.setCanEdit(true); grid.setEditEvent(ListGridEditEvent.DOUBLECLICK); VLayout main = new VLayout(); main.addMember(filterBuilder); main.addMember(grid); main.draw(); } }
Comment