Below a complete code :
As you can see, i have 2 TextBoxes. The first one is added to the GWT vertical Panel. The second one is added to the HLayout.
Result : The first one doesn't get events during editing
The second one works perfectly
Thanks!
Code:
public class TestModule implements EntryPoint { public void onModuleLoad() { final ListGrid countryGrid = new ListGrid(); countryGrid.setModalEditing(true); countryGrid.setWidth(550); countryGrid.setHeight(224); countryGrid.setAlternateRecordStyles(true); countryGrid.setShowAllRecords(true); countryGrid.setCellHeight(22); // use server-side dataSource so edits are retained across page transitions countryGrid.setDataSource(CountryXmlDS.getInstance()); ListGridField countryCodeField = new ListGridField("countryCode", "Flag", 40); countryCodeField.setAlign(Alignment.CENTER); countryCodeField.setType(ListGridFieldType.IMAGE); countryCodeField.setImageURLPrefix("flags/16/"); countryCodeField.setImageURLSuffix(".png"); countryCodeField.setCanEdit(false); ListGridField nameField = new ListGridField("countryName", "Country"); ListGridField continentField = new ListGridField("continent", "Continent"); continentField.setCanToggle(true); ListGridField memberG8Field = new ListGridField("member_g8", "Member G8"); ListGridField populationField = new ListGridField("population", "Population"); populationField.setType(ListGridFieldType.INTEGER); populationField.setCellFormatter(new CellFormatter() { public String format(Object value, ListGridRecord record, int rowNum, int colNum) { NumberFormat nf = NumberFormat.getFormat("0,000"); return nf.format(((Number) value).longValue()); } }); ListGridField independenceField = new ListGridField("independence", "Independence"); countryGrid.setFields(countryCodeField, nameField,continentField, memberG8Field, populationField, independenceField); countryGrid.setAutoFetchData(true); countryGrid.setCanEdit(true); countryGrid.setEditEvent(ListGridEditEvent.CLICK); countryGrid.setEditByCell(true); VerticalPanel gwtPanel = new VerticalPanel(); TextBox boxInGWTPanel = new TextBox(); DOM.setStyleAttribute(boxInGWTPanel.getElement(), "border", "solid black 4px"); gwtPanel.add(countryGrid); gwtPanel.add(boxInGWTPanel); RootPanel.get().add(gwtPanel); DOM.setStyleAttribute(RootPanel.get().getElement(), "z-index", "200000"); HLayout layout = new HLayout(); TextBox boxInHLayout = new TextBox(); layout.addChild(boxInHLayout); layout.draw(); } static public class CountryXmlDS extends DataSource { private static CountryXmlDS instance = null; public static CountryXmlDS getInstance() { if (instance == null) { instance = new CountryXmlDS("countryDS"); } return instance; } public CountryXmlDS(String id) { setID(id); //setRecordXPath("/List/country"); 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"); 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)"); DataSourceLinkField articleField = new DataSourceLinkField("article", "Info"); setFields(pkField, countryCodeField, countryNameField, capitalField, governmentField, memberG8Field, continentField, independenceField, areaField, populationField, gdpField, articleField); setDataURL("countryData.json"); setClientOnly(true); } } }
Result : The first one doesn't get events during editing
The second one works perfectly
Thanks!
Comment