Announcement

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

    Filtering list grid does not work with expansion components

    Hello,

    Filtering list grid with expansion components seems to be broken in 3.1d version. Reproducible with following code.

    Code:
        public void onModuleLoad() {
            // our viewport
            viewport = new VLayout();
            viewport.setWidth100();
            viewport.setHeight100();
    
            final DataSource ds = new DataSource();
            DataSourceTextField pk = new DataSourceTextField("pk");
            pk.setPrimaryKey(true);
            DataSourceTextField text = new DataSourceTextField("text");
            ds.setFields(pk, text);
            ds.setClientOnly(true);
            ds.setTestData(new Record[] { gr(1), gr(2), gr(3), gr(4), gr(5), gr(6), gr(7), gr(8) });
    
            ListGrid grid = new ListGrid() {
                @Override
                protected Canvas getExpansionComponent(ListGridRecord record) {
                    return new Label("This is a label");
                }
            };
            grid.setSize("400", "200");
            grid.setCanExpandRecords(true);
            grid.setCanExpandMultipleRecords(true);
            grid.setDataFetchMode(FetchMode.LOCAL);
            grid.setShowFilterEditor(true);
            grid.setDataSource(ds);
            grid.setAutoFetchData(true);
            viewport.addMember(grid);
            viewport.draw();
        }
    
        public ListGridRecord gr(int i) {
            ListGridRecord r = new ListGridRecord();
            r.setAttribute("pk", "primarykey" + i);
            r.setAttribute("text", "text content for record " + i);
            return r;
        }
    By opening up the expansion labels on rows and using the filtering on data breaks up the grid. The expansion handles get "stuck", expansion components get lost some times. Error console also might get these:

    Code:
    com.smartgwt.client.core.JsObject$SGWT_WARN: 13:45:54.173:MUP7:WARN:Log:TypeError: _1 is null Stack from error.stack:     
    [a]MathFunction.isObserving(_1=>null,  _2=>"resized")
    ...
    To reproduce one symptom of the problem every time follow these steps:

    1. expand rows 1 and 2 in grid so that the label is visible
    2. enter "primarykey1" in pk field's filter and press enter
    3. ... grid filters so that only row 1 is visible, the expansion handle is closed but still a stale expansion component is shown ?

    Like said this is just one symptom. Other error situations are usually encountered when using the expansion components and filter toolbar simultaneously.

    Tested with smartgwt 3.1d LGPL nightly 2012-08-21, Firefox 12.0, Mac OSX.

    #2
    In addition to the problem described earlier hovering mouse over group labels of list grid in 3.1d floods the log with messages

    Code:
    TMR2:WARN:Log:findByKeys: passed record does not have a value for key field 'id'
    TMR2:WARN:Log:findByKeys: passed record does not have a value for key field 'id'
    TMR2:WARN:Log:findByKeys: passed record does not have a value for key field 'id'
    ...
    Reproducible by grouping any list grid in 3.1 and moving mouse cursor over the group header rows.

    Tested with smartgwt 3.1d LGPL nightly 2012-08-21, Firefox 12.0, Mac OSX.

    Comment


      #3
      We've made a change which we believe resolves this. Please try the next nightly build (dated Aug 24 or greater)

      Regards
      Isomorphic Software

      Comment


        #4
        With a brief testing the expansion components seem to work ok now in my test case and in the application I'm developing. The findByKeys error does not show up with the stand alone test case but I'm still getting them in my actual application though. As earlier these appear only when I group a grid:

        Code:
        TMR4:WARN:Log:findByKeys: passed record does not have a value for key field 'id'
        com.smartgwt.client.core.JsObject$SGWT_WARN: 10:22:02.528:TMR4:WARN:Log:findByKeys: passed record does not have a value for key field 'id' 
        ...
        at com.smartgwt.client.widgets.grid.ListGrid.getCellCSSText(ListGrid.java)
        ...
        In addition to above these warnings started appearing in application draw phase when upgrading from -21 nightly to -24:

        Code:
        XRP9:WARN:Button:isc_Button_33:ignoring bad or negative width: NaN [enable 'sizing' log for stack trace]
        com.smartgwt.client.core.JsObject$SGWT_WARN: 10:18:41.415:XRP9:WARN:Button:isc_Button_33:ignoring bad or negative width: NaN [enable 'sizing' log for stack trace] 
        ...
        at com.smartgwt.client.widgets.Canvas.parentResized(Canvas.java)
        ...
        at com.smartgwt.client.widgets.BaseWidget.draw(BaseWidget.java)
        ...
        Everything seems to work as earlier (at least the buttons look and work ok) but the errors warnings appeared. Never got these before.

        Now using LGPL nightly 3.1d 2012-08-24.

        Comment


          #5
          These warnings can appear legitimately - if you can show us how you can get them with correct usage we can take a look.

          Comment


            #6
            Originally posted by markok View Post
            With a brief testing the expansion components seem to work ok now in my test case and in the application I'm developing. The findByKeys error does not show up with the stand alone test case but I'm still getting them in my actual application though. As earlier these appear only when I group a grid:

            Code:
            TMR4:WARN:Log:findByKeys: passed record does not have a value for key field 'id'
            com.smartgwt.client.core.JsObject$SGWT_WARN: 10:22:02.528:TMR4:WARN:Log:findByKeys: passed record does not have a value for key field 'id' 
            ...
            at com.smartgwt.client.widgets.grid.ListGrid.getCellCSSText(ListGrid.java)
            ...
            This is easily replicated by just using the original stand alone test case I sent you earlier and grouping the content by "text" field.

            Originally posted by markok View Post
            In addition to above these warnings started appearing in application draw phase when upgrading from -21 nightly to -24:

            Code:
            XRP9:WARN:Button:isc_Button_33:ignoring bad or negative width: NaN [enable 'sizing' log for stack trace]
            com.smartgwt.client.core.JsObject$SGWT_WARN: 10:18:41.415:XRP9:WARN:Button:isc_Button_33:ignoring bad or negative width: NaN [enable 'sizing' log for stack trace] 
            ...
            at com.smartgwt.client.widgets.Canvas.parentResized(Canvas.java)
            ...
            at com.smartgwt.client.widgets.BaseWidget.draw(BaseWidget.java)
            ...
            Everything seems to work as earlier (at least the buttons look and work ok) but the errors warnings appeared. Never got these before.

            Now using LGPL nightly 3.1d 2012-08-24.
            I debugged this one too and it seems all the "buttons" logging this warning are actually list grid's header row cells. I tried looking into the setup of these problematic fields. It seems that these fields are all fields which are set up to accommodate all leftover space in grid either by setting the width to "*" or leaving the width unset as all other fields have a static width set.
            Last edited by markok; 27 Aug 2012, 01:43.

            Comment


              #7
              This is interesting data, but what we really need is runnable code that reproduces the issue. We could very easily take your analysis and not be able to find any issue because reproducing the problem requires code you haven't shared, or because there is no bug (just bad usage).

              So we need runnable code to look at the issue.

              Comment


                #8
                As I said the findByKeys-problem is reproduced with the example code I sent you in first place. Just group the data with "text" column and you'll get the warnings as earlier.

                For the second issue yes I'll try to find time to get a stand alone test case for it. I had a go for it already with little success - I think it is some obscure combination code which causes this.

                I did some comparisons on 3.0 and 3.1 ListGrid.js and header creation code has some changes on autofitting logic. I suspect a culprit is here somehow and if understood what actually has changed might help debugging this.

                Comment


                  #9
                  Finally, got a test code for second issue:

                  Code:
                      public void onModuleLoad() {
                          // our viewport
                          viewport = new VLayout();
                          viewport.setWidth100();
                          viewport.setHeight100();
                  
                          final DataSource ds = new DataSource();
                          DataSourceTextField pk = new DataSourceTextField("id");
                          pk.setPrimaryKey(true);
                          DataSourceTextField text = new DataSourceTextField("text");
                          ds.setFields(pk, text);
                          ds.setClientOnly(true);
                          ds.setTestData(new Record[] { gr(1), gr(2), gr(3), gr(4), gr(5), gr(6), gr(7), gr(8) });
                  
                          final ListGrid grid = new ListGrid();
                          grid.setWidth100();
                          grid.setHeight100();
                          grid.setDataSource(ds);
                          grid.setAutoFetchData(true);
                  
                          final ListGridField pkField = new ListGridField("id");
                          pkField.setWidth(80);
                  
                          final ListGridField textField = new ListGridField("text");
                          textField.setWidth("*");
                  
                          grid.setFields(pkField, textField);
                  
                          // if grid in Canvas container gives out NaN warnings on resize
                          Canvas container = new Canvas();
                          container.setWidth100();
                          container.setHeight100();
                          container.addChild(grid);
                  
                          viewport.addMember(container);
                          viewport.draw();
                      }
                  
                      public ListGridRecord gr(int i) {
                          ListGridRecord r = new ListGridRecord();
                          r.setAttribute("id", "primarykey" + i);
                          r.setAttribute("text", "text content for record " + i);
                          return r;
                      }
                  To reproduce with code above resize the browser after draw. List grid will print out NaN warnings on width of the "text" header button if the grid is contained as a child in a Canvas.

                  And as I said the separate findByKeys-problem is reproduced by grouping the data with "text" column and moving the mouse over group header rows.

                  Comment


                    #10
                    The warnings you mention should now be fixed by the next nightly build of SC 8.3d/ SGWT 3.1d.

                    Comment

                    Working...
                    X