Announcement

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

    MiniDateRangeItem with relative dates fails

    Hi,

    I've come across a bug in MiniDateRangeItem used with ListGrid as filter editor.

    I've got simple DataSource with DataSourceDateTimeField. Then it's connected to ListGrid with filterEditor enabled. All filterEditor settings are set to default.
    When I try to filter using exact date chooser it works fine but when I try to use relative date (even yesterday) all fails with this message on a console:
    Code:
    20:59:37.028:TMR7:WARN:Log:TypeError: _2.getMonth is not a function
        Date.getFormattedDateRangeString([object Date], {Obj})
        MiniDateRangeItem.mapValueToDisplay(_1=>{Obj})
        FormItem.setValue(_1=>{Obj})
        Class.invokeSuper(_1=>null,  _2=>"setValue")
        Class.Super(_1=>"setValue",  _2=>{Obj})
        MiniDateRangeItem.setValue({Obj})
        DynamicForm.setValue("date_init", {Obj})
        ListGrid._displayNewEditValues(0, undef, {Obj})
        ListGrid.setEditValues(0, {Obj})
        ListGrid.updateFilterEditor()
        ListGrid.setFilterValues({Obj})
        ListGrid._filter("fetch", {Obj}, null, {Obj})
        Canvas.fetchData({Obj}, null, {Obj})
        [c]Class.fireCallback(_1=>{Obj},  _2=>undef,  _3=>[object Array],  _4=>{Obj})
        Class._fireActionsOnPause()
        [c]Class.fireCallback(_1=>{Obj},  _2=>undef,  _3=>[object Array],  _4=>{Obj},  _5=>true)
        Timer._fireTimeout("$ir349")
        unnamed()
        unnamed()
    I've tried to disable this feature but it's enabled by default. When I tried to call allowRelativeDates() all fails again with this message:
    Code:
    20:18:38.163 [ERROR] [pl.lapassion.admin.panel.AdminPanel] Uncaught exception escaped
    com.google.gwt.core.client.JavaScriptException: (TypeError): self.allowRelativeDates is not a function
     fileName: http://localhost
     lineNumber: 61
     stack: ()@http://localhost:61
    @:0
    Above was of course observed on an MiniDateRangeItem set as filter editor type to a ListGridField.

    Everything was observed on latest build from SVN and firefox browser. It works fine on version 2.2 but I cannot set initial criteria on it. Or maybe I'm trying to do this the hard way:
    Code:
    Date d = new Date();
    d.setDate(1);
    AdvancedCriteria[] criteria = {
      new AdvancedCriteria("date_init", OperatorId.GREATER_OR_EQUAL , d)
    };
    
    dataGrid.setFilterEditorCriteria(new AdvancedCriteria(OperatorId.AND, criteria));
    dataGrid.fetchData(dataGrid.getFilterEditorCriteria());
    Thanks for any help
    Mariusz Goch

    #2
    This problem was corrected after 2.2, try a nightly.

    Comment


      #3
      Thank you for your response.
      I've checked this on latest version from SmartGWT SVN:

      SmartClient Version: SC_SNAPSHOT-2010-09-11/LGPL Development Only (built 2010-09-11)

      GWT: 2.0.4

      Thanks for any help

      Comment


        #4
        Use smartclient.com/builds, not SVN.

        Comment


          #5
          I've checked with this version:
          http://www.smartclient.com/builds/SmartGWT/2.x/LGPL/2010-09-15
          and the same errors appeared.
          What is strange is that correct dates are shown in the editor widget above ListGrid. No data is being filter due to the error by the dates are calculated correctly. So why all works when I just pick the same date using calendar?

          Comment


            #6
            Maybe this will help. On Eclipse console I've found that error happens on line 661 in sc/modules/ISC_Core.js
            Best regards

            Comment


              #7
              Apparently this is a different problem from the one we already fixed, so please create a standalone test case showing how it can be reproduced.

              Comment


                #8
                This simple code will generate this error:
                Code:
                DataSource ds = new DataSource();
                ds.addField(new DataSourceDateTimeField("date_init"));
                		
                ListGrid listGrid = new ListGrid();
                listGrid.setWidth100();
                listGrid.setHeight100();
                listGrid.setDataSource(ds);
                listGrid.setShowFilterEditor(true);
                	
                mainLayout.addMember(listGrid);
                No data needs to be loaded. Just open range editor, select any date by relative option(for example Yesterday), accept selection and click filter button.
                The same errors appears. Just like on my original case.
                Best regards

                Comment


                  #9
                  Hi,
                  Don't know what was changed but on yesterdays nightly build locale on MiniDatePicker relative options kicked in. Before there wasn't any Polish locale in this widget.
                  Unfortunately it still doesn't work.
                  What are the chances that this will be corrected soon?
                  Is there a way to disable relative chooser and just leave standard calendar pickers?
                  Best regards

                  Comment


                    #10
                    We'll look into it and post an update.

                    Comment


                      #11
                      I tried running the code below using the latest build and for the filter selected Form: Yesterday, To: Tomorrow and clicked the OK button and there was no JS error.

                      There was a warning in the GWT dev console but this is not the error you're talking about.

                      "WARN:DynamicForm:isc_DynamicForm_0:focusInItem: item cannot accept focus: [MiniDateRangeItem ID:isc_MiniDateRangeItem_0 name:date_init]"


                      Please try using the latest build and clear your browser cache and try your sample again. If you're having, state very clearly the detailed steps you're following along with a standalone testcase.

                      Code:
                      public void onModuleLoad() {
                      
                          DataSource ds = new DataSource();
                          ds.addField(new DataSourceDateTimeField("date_init"));
                      
                          ListGrid listGrid = new ListGrid();
                          listGrid.setWidth100();
                          listGrid.setHeight100();
                          listGrid.setDataSource(ds);
                          listGrid.setShowFilterEditor(true);
                      
                          listGrid.draw();
                      }

                      Comment


                        #12
                        I see that the error show up when the filter icon is clicked. This has been fixed. Please pick up the next nightly build.

                        Sanjiv

                        Comment


                          #13
                          Ok. Thanks very much.
                          Really looking forward to this.
                          By the way, great job :)
                          Best regards

                          Comment


                            #14
                            I've just checked everything with latest nightly and the error mentioned before disappeared but I'm sorry to report that much more problems appeared.
                            Test case assumes large data set loaded by RestDataSource.

                            1. Everything works much much slower. It's really visible on large dataset.

                            2. MiniDateRangeItem works only partially. After choosing the dates they appear correctly on filter editor but as soon as filters are applied they disappear. Data are downloaded correctly but you don't see any more a date range.
                            After that when you try to apply filter for any other field data range is no more active and whole data are fetched.

                            3. Applying AdvancedCriteria to ListGrid by setFilterEditorCriteria() throws exception:
                            Code:
                            15:51:08.248:WARN:ListGrid:isc_ListGrid_0:Advanced criteria includes criteria for field:date_init with operator greaterOrEqual. Unable to display this type of criteria in the filter editor.
                            com.smartgwt.client.core.JsObject$SGWT_WARN: 15:51:08.248:WARN:ListGrid:isc_ListGrid_0:Advanced criteria includes criteria for field:date_init with operator greaterOrEqual. Unable to display this type of criteria in the filter editor.
                            It worked before fine.

                            All of above I've checked on Development Mode and after compilation.
                            Also I've checked all situations on different ListGrid and DataSource configurations to be sure that other settings didn't inflict this behaviour.

                            Best regards
                            Mariusz Goch

                            Comment


                              #15
                              Please mention specifically what build you are using and what was the previous build where things were faster.

                              Originally posted by pH4Lk0n
                              1. Everything works much much slower. It's really visible on large dataset.
                              Be more specific about what exactly has become slower. We don't think any related code change has been made so a standalone testcase would be helpful.

                              Originally posted by pH4Lk0n
                              2. MiniDateRangeItem works only partially. After choosing the dates they appear correctly on filter editor but as soon as filters are applied they disappear. Data are downloaded correctly but you don't see any more a date range.
                              After that when you try to apply filter for any other field data range is no more active and whole data are fetched.

                              3. Applying AdvancedCriteria to ListGrid by setFilterEditorCriteria() throws exception:
                              Code:
                              15:51:08.248:WARN:ListGrid:isc_ListGrid_0:Advanced criteria includes criteria for field:date_init with operator greaterOrEqual. Unable to display this type of criteria in the filter editor.
                              com.smartgwt.client.core.JsObject$SGWT_WARN: 15:51:08.248:WARN:ListGrid:isc_ListGrid_0:Advanced criteria includes criteria for field:date_init with operator greaterOrEqual. Unable to display this type of criteria in the filter editor.
                              We'll try to reproduce this using your testcase.

                              Comment

                              Working...
                              X