Hi!
I'm facing problems when i use a FilterBuilder with a MiniDateRangeItem.
In my project I'd like to persist the criteria of the FilterBuilder to a database using JSON.encode/decode. The problem is, that if you take the criteria of the FilterBuilder and want to set it again the criteria just gets lost.
I've isolated the problem and excluded JSON to be the problem.
How to reproduce with the small sample:
Just select a date with the MiniDateRangeItem and use the "set Criteria" button. On the first click the data just gets lost but is drawn correctly.
It is possible to "repair" the criteria by open the MiniDateRangeItem again and just press cancel or ok. Otherwise if you click a second time on the "set Criteria" button everything is gone.
Please advise how to use this component within an FilterBuilder or have a look if this is a bug.
Thanks!
1. the SmartGWT or SmartClient version and browser version(s) involved;
InternetExplorer 9.0.8112.16421
SmartGWT Pro 2.3.0
I've tried the latest 3.0 nightly yesterday.
3. for a client-side problem, the contents of the Developer Console (see FAQ for usage);
Just "bad or negative width" warnings and "item cannot accept focus" warnings.
4. if there is a JavaScript error, the stack trace logged in the Developer Console (from Internet Explorer if possible);
No JS error.
5. sample code.
Entrypointmainclass:
FilterBuilderDataSource:
I'm facing problems when i use a FilterBuilder with a MiniDateRangeItem.
In my project I'd like to persist the criteria of the FilterBuilder to a database using JSON.encode/decode. The problem is, that if you take the criteria of the FilterBuilder and want to set it again the criteria just gets lost.
I've isolated the problem and excluded JSON to be the problem.
How to reproduce with the small sample:
Just select a date with the MiniDateRangeItem and use the "set Criteria" button. On the first click the data just gets lost but is drawn correctly.
It is possible to "repair" the criteria by open the MiniDateRangeItem again and just press cancel or ok. Otherwise if you click a second time on the "set Criteria" button everything is gone.
Please advise how to use this component within an FilterBuilder or have a look if this is a bug.
Thanks!
1. the SmartGWT or SmartClient version and browser version(s) involved;
InternetExplorer 9.0.8112.16421
SmartGWT Pro 2.3.0
I've tried the latest 3.0 nightly yesterday.
3. for a client-side problem, the contents of the Developer Console (see FAQ for usage);
Just "bad or negative width" warnings and "item cannot accept focus" warnings.
4. if there is a JavaScript error, the stack trace logged in the Developer Console (from Internet Explorer if possible);
No JS error.
5. sample code.
Entrypointmainclass:
Code:
package xxx.gwt.test.client; import xxx.gwt.test.client.components.FilterBuilderDS; import com.google.gwt.core.client.EntryPoint; 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.form.FilterBuilder; import com.smartgwt.client.widgets.layout.VLayout; public class GWTTestClient implements EntryPoint { @Override public void onModuleLoad() { VLayout root = new VLayout(); final FilterBuilder filterbuilder = new FilterBuilder(); filterbuilder.setDataSource(new FilterBuilderDS()); IButton testbutton = new IButton("set Criteria"); testbutton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { int i = filterbuilder.getCriteria().getCriteria().length; System.out.println("before:" + i); filterbuilder.setCriteria(filterbuilder.getCriteria()); filterbuilder.redraw(); i = filterbuilder.getCriteria().getCriteria().length; System.out.println("after:" + i); } }); root.addMember(filterbuilder); root.addMember(testbutton); root.draw(); } }
Code:
package xxx.gwt.test.client.components; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.DataSourceField; import com.smartgwt.client.data.fields.DataSourceDateTimeField; import com.smartgwt.client.data.fields.DataSourceTextField; import com.smartgwt.client.types.FieldType; import com.smartgwt.client.widgets.form.fields.FormItem; import com.smartgwt.client.widgets.form.fields.MiniDateRangeItem; public class FilterBuilderDS extends DataSource { public FilterBuilderDS() { DataSourceField datetime = new DataSourceDateTimeField("DateRangeComp", "Date"); FormItem datetimeItem = new MiniDateRangeItem(); datetimeItem.setType(FieldType.DATETIME.getValue()); datetime.setEditorType(datetimeItem); datetime.setType(FieldType.DATETIME); DataSourceField stringfilter = new DataSourceTextField("StringComp", "String"); setFields(datetime, stringfilter); } }
Comment