When using a filterbuilder with the 'between' operator on a date this happens:
When both filtervalues are 'relative' it sends something like:
But when one is relative and one is absolute it sends:
Java code:
Datasource:
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" }
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(); } }
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>
Comment