Announcement

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

    Inconsistent criteria serialization of Date field

    Hi,
    In the following example there is the RestDataSource with Date (not DateTime) field attached to the FilterBuilder and the ListGrid.

    When entering greater_or_equal criteria the FilterBuilder generates this fine request:
    Code:
    <request>
        <data>
            <isc_RestDataSource_0 constructor="AdvancedCriteria">
                <operator>and</operator>
                <criteria>
                    <fieldName>independence</fieldName>
                    <operator>greaterOrEqual</operator>
                    <value>2010-11-16</value>
                </criteria>
            </isc_RestDataSource_0>
        </data>
        <dataSource>isc_RestDataSource_0</dataSource>
        <operationType>fetch</operationType>
        <startRow>0</startRow>
        <endRow>75</endRow>
        <textMatchStyle>substring</textMatchStyle>
        <componentId>isc_ListGrid_0</componentId>
        <oldValues></oldValues>
    </request>
    Hoowever, when the same criteria is entered into the ListGrid filter row, then ListGrid generates this request:
    Code:
    <request>
        <data>
            <isc_RestDataSource_0 constructor="AdvancedCriteria">
                <operator>and</operator>
                <criteria>
                    <_constructor>AdvancedCriteria</_constructor>
                    <operator>and</operator>
                    <criteria>
                        <elem>
                            <fieldName>independence</fieldName>
                            <operator>greaterOrEqual</operator>
                            <value>2010-11-15T23:00:00</value>
                        </elem>
                    </criteria>
                </criteria>
            </isc_RestDataSource_0>
        </data>
        <dataSource>isc_RestDataSource_0</dataSource>
        <operationType>fetch</operationType>
        <startRow>0</startRow>
        <endRow>75</endRow>
        <textMatchStyle>substring</textMatchStyle>
        <componentId>isc_ListGrid_0</componentId>
        <oldValues></oldValues>
    </request>
    This time the Date serialization is different/wrong as it contains time information (GMT):
    <value>2010-11-15T23:00:00</value>

    The test case:
    Code:
    package org.yournamehere.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.GWT;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.OperationBinding;
    import com.smartgwt.client.data.RestDataSource;
    import com.smartgwt.client.data.fields.DataSourceDateField;
    import com.smartgwt.client.types.DSDataFormat;
    import com.smartgwt.client.types.DSOperationType;
    import com.smartgwt.client.types.DSProtocol;
    import com.smartgwt.client.util.SC;
    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.grid.ListGrid;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class MainEntryPoint implements EntryPoint {
    
        public MainEntryPoint() {
            SC.showConsole();
        }
    
        public void onModuleLoad() {
    
            RestDataSource ds = new RestDataSource();
            ds.setDataFormat(DSDataFormat.XML);
            ds.setDataURL("/umowyserwis/UmowyRest");
            OperationBinding fetch = new OperationBinding();
            fetch.setOperationType(DSOperationType.FETCH);
            fetch.setDataProtocol(DSProtocol.POSTMESSAGE);
            ds.setOperationBindings(fetch);
    
            DataSourceDateField independenceField = new DataSourceDateField("independence");
    
            ds.setFields(independenceField);
    
            final FilterBuilder filter = new FilterBuilder();
            filter.setDataSource(ds);
    
            final ListGrid grid = new ListGrid();
            grid.setShowFilterEditor(true);
            grid.setDataSource(ds);
    
            final IButton filterButton = new IButton("Search");
            filterButton.addClickHandler(new ClickHandler() {
    
                public void onClick(ClickEvent event) {
                    try {
                        grid.filterData(filter.getCriteria());
                    } catch (Exception e) {
                        GWT.log(e.getLocalizedMessage(), e);
                        e.printStackTrace();
                    }
                }
            });
    
            VLayout main = new VLayout();
            main.addMember(filter);
            main.addMember(filterButton);
            main.addMember(grid);
            main.draw();
        }
    }
    SmartGWT nightly build 2010-11-15 (and previous versions).

    Could this be corrected in the future releases ?
    Thanks,
    MichalG

    #2
    Hi Michael
    We've made a change to resolve this issue which will show up in the next nightly build. Please let us know if you continue to see this issue.

    Regards
    Isomorphic Software

    Comment


      #3
      Thanks for your time, Isomorphic.
      I have checked against nightly 2011-02-10 and it is now fine if I choose explicitly any date from the picker. Unfortunately date is still serialized with time in GMT format, when I choose one of the predefined mnemonics like <Today> or <N weeks ago>.
      MichalG

      Comment


        #4
        Ah yes - we did miss that case.
        Fixed now - try the next nightly!
        Thanks
        Isomorphic Software

        Comment

        Working...
        X