Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    FilterBuilder with MiniDateRangeItem

    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:
    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();
    	}
    }
    FilterBuilderDataSource:
    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);
    	}
    }

    #2
    Is someone already looking into the matter?
    Please inform

    Comment


      #3
      Thanks for the report - we've addressed this and the fix will appear in the 3.0p and 3.1d branches shortly

      Comment


        #4
        Many Thanks!
        I'm looking forward to get the new version!

        Comment


          #5
          Hi,

          You were using the MiniDateRangeItem, but you have the PRO license. I just came to the conclusion that I couldn't use it (I have the PRO edition) because it uses advancedCriteria, which is only available for the power edition and above.
          So: is it possible to use the MiniDateRangeItem with the pro edition?

          Comment


            #6
            AdvancedCriteria works in all editions including LGPL.

            The actual license difference is that the default SQL & JPA/Hibernate connectors do not support filtering by AdvancedCriteria on the server in Pro, but do in Power and above.

            You can implement your own server-side support for AdvancedCriteria in Pro to get around this, but if you'd rather not maintain code like that, you can upgrade to Power by just paying the difference. This also upgrades the built-in connectors in other ways (like Transactions, SQL Templating, etc). If you plan to rely on the built-in connectors for pretty much everything, we highly recommend Power over Pro.

            Comment

            Working...
            X