Announcement

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

    Inconsistency in criteria sent to server by FilterBuilder (concerning dates)

    When using a filterbuilder with the 'between' operator on a date this happens:
    When both filtervalues are 'relative' it sends something like:

    Code:
    "criteria":[
                    {
                        "fieldName":"cntn_createdOn", 
                        "operator":"between", 
                        "start":"2010-10-27T22:00:00", 
                        "end":"2010-09-28T11:46:36"
                    }
    But when one is relative and one is absolute it sends:
    Code:
    "criteria":[
                    {
                        "fieldName":"cntn_createdOn", 
                        "operator":"between", 
                        "start":{
                            "value":"$today"
                        }, 
                        "end":"2011-11-10T23:00:00"
                    }

    Java code:

    Code:
    package test.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.DataSource;
    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 FilterBuilderTest implements EntryPoint {
    	
    	public void onModuleLoad() {
    		final DataSource ds = DataSource.get("contents");
    		
    		final FilterBuilder filterBuilder = new FilterBuilder();
    		final IButton filterButton = new IButton("filter");
    		filterButton.addClickHandler(new ClickHandler() {
    			public void onClick(ClickEvent event) {
    				ds.fetchData(filterBuilder.getCriteria());
    			}
    		});
    		filterBuilder.setDataSource(ds);
    		
    		VLayout vLayout = new VLayout();
    		vLayout.addMember(filterBuilder);
    		vLayout.addMember(filterButton);
    		vLayout.draw();
    	}
    
    }
    Datasource:

    Code:
    <DataSource ID="contents" serverType="sql" tableName="content">
    	<fields>
    		<field primaryKey="true" type="sequence" name="cntn_pk" hidden="true" export="false"></field>
    		<field type="datetime" name="cntn_createdOn" canEdit="false" canFilter="true" title="" detail="true" showInGrid="true" export="true"></field>
    		<field type="text" length="45" name="cntn_id" required="true" exportable="true" export="true"></field>
    		<field title="bar" type="text" length="45" name="cntn_barCode" showInGrid="true" canEdit="false" export="true"></field>
    		<field type="integer" name="cntn_fk_location" hidden="false"></field>
    		<field title="quantity" type="float" name="cntn_quantity" export="true"></field>
    		<field title="unit" type="text" length="45" name="cntn_unit" export="true" ></field>
    	</fields>
    </DataSource>

    #2
    You omitted all version information and other required details.

    Comment


      #3
      Hi,

      I am using: SmartClient Version: SC_SNAPSHOT-2010-10-11/PowerEdition Deployment (built 2010-10-11) with GWT 2.0.4 On firefox 3.6.12

      Comment


        #4
        This was indeed a bug. We've now resolved this and the fix will be present in nightly builds from this point forward.

        Comment

        Working...
        X