package com.smartgwt.sample.showcase.client.dataintegration.java.sortfilter; import com.smartgwt.client.data.AdvancedCriteria; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.OperatorId; import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.sample.showcase.client.Showcase; import com.google.gwt.core.client.EntryPoint; public class GridFilterWindowSample implements EntryPoint { @Override public void onModuleLoad() { VLayout vLayout = new VLayout(); vLayout.setMembersMargin(5); final ListGrid countryGrid = new ListGrid(); countryGrid.setWidth(700); countryGrid.setHeight(300); countryGrid.setDataSource(DataSource.get("worldDS")); ListGridField countryCodeField = new ListGridField("countryCode", "Code", 50); ListGridField nameField = new ListGridField("countryName", "Country"); ListGridField capitalField = new ListGridField("capital", "Capital"); ListGridField continentField = new ListGridField("continent", "Continent"); ListGridField areaField = new ListGridField("area", "Area (km²)"); ListGridField populationField = new ListGridField("population", "Population"); countryGrid.setFields(countryCodeField, nameField, capitalField, continentField, areaField, populationField); countryGrid.setAutoFetchData(true); countryGrid.setShowFilterEditor(true); AdvancedCriteria criteria = new AdvancedCriteria(OperatorId.AND, new AdvancedCriteria[] { new AdvancedCriteria("countryName", OperatorId.INOT_CONTAINS, "i"), new AdvancedCriteria("capital", OperatorId.INOT_STARTS_WITH, "p") }); countryGrid.setAllowFilterOperators(true); countryGrid.setCriteria(criteria); IButton fwButton = new IButton(); fwButton.setTitle("Show Filter Window"); fwButton.setWidth(150); fwButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { countryGrid.showFilterWindow(); } }); vLayout.addMember(countryGrid); vLayout.addMember(fwButton); vLayout.draw(); } }