Hi Smart GWT,
My Smart GWT version is: SC_SNAPSHOT-2011-08-02/PowerEdition Deployment (built 2011-08-02) and browser is Firefox 22.0
I need you to clarify me how grid filter works and to suggest me what is the best way to do something.
I have a grid that in code looks like this:
Basically, it is the grid from your Showcase application, example Grids/Filtering/Live filter. I made one change to the code from your example. I added AdvancedCriteria to the grid. As you can see, grid is based on data source, it has filter editor enabled and it has criteria to filter the data.
When user enters some value in any filter editor field during runtime, then data in the grid are filtered by combining newly entered criteria and criteria which has been set on grid in code. That is how grid filter should work and I get such behaviour.
Now, I have need to set filter editors values from code. For example, I have added button on interface and I need to set specific values in filter editor when user clicks that button. Also, I want to filter grid by combining two criteria, one entered in click handler and one initially set on grid. Button and its click handler looks like this:
Be sure your post includes:
1. the *complete* SmartGWT or SmartClient version from the lower left-hand corner of the Developer Console (see FAQ for how to open Developer Console), for example, \"v8.2p_2012-04-18/PowerEdition Deployment\"
2. browser(s) and version(s) involved
3. for a server-side problem, the *complete* logs generated during processing of the failing request (do *not* trim to just the error message)
4. for any problem processing a server response, the actual response as shown in the RPC tab in the Developer Console
5. if there is a JavaScript error, the stack trace logged in the Developer Console (see FAQ)
6. sample code if applicable
Posts with incomplete information are much more likely to be ignored.
My Smart GWT version is: SC_SNAPSHOT-2011-08-02/PowerEdition Deployment (built 2011-08-02) and browser is Firefox 22.0
I need you to clarify me how grid filter works and to suggest me what is the best way to do something.
I have a grid that in code looks like this:
Code:
final ListGrid countryGrid = new ListGrid(); countryGrid.setShowFilterEditor(true); countryGrid.setFilterOnKeypress(true); countryGrid.setDataSource(WorldXmlDS.getInstance()); countryGrid.setAutoFetchData(true); 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"); countryGrid.setFields(countryCodeField, nameField, capitalField, continentField); // Add criteria AdvancedCriteria criteria = new AdvancedCriteria(OperatorId.AND, new Criterion[] {}); Criterion c1 = new Criterion("continent", OperatorId.EQUALS, "Europe"); criteria.addCriteria(c1); countryGrid.setCriteria(criteria);
When user enters some value in any filter editor field during runtime, then data in the grid are filtered by combining newly entered criteria and criteria which has been set on grid in code. That is how grid filter should work and I get such behaviour.
Now, I have need to set filter editors values from code. For example, I have added button on interface and I need to set specific values in filter editor when user clicks that button. Also, I want to filter grid by combining two criteria, one entered in click handler and one initially set on grid. Button and its click handler looks like this:
Code:
Button testBtn = new Button("Set filter"); testBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Criteria criteria = new Criteria("countryName", "Israel"); // countryGrid.setCriteria(criteria); countryGrid.setFilterEditorCriteria(criteria); countryGrid.filterByEditor(); } });
Be sure your post includes:
1. the *complete* SmartGWT or SmartClient version from the lower left-hand corner of the Developer Console (see FAQ for how to open Developer Console), for example, \"v8.2p_2012-04-18/PowerEdition Deployment\"
2. browser(s) and version(s) involved
3. for a server-side problem, the *complete* logs generated during processing of the failing request (do *not* trim to just the error message)
4. for any problem processing a server response, the actual response as shown in the RPC tab in the Developer Console
5. if there is a JavaScript error, the stack trace logged in the Developer Console (see FAQ)
6. sample code if applicable
Posts with incomplete information are much more likely to be ignored.