Announcement

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

    Exception logged when calling setData on listgrid with expanded rows

    Isomorphic,

    I'm using SmartClient Version: v10.1p_2016-03-11/Pro Deployment (built 2016-03-11) and I get the following warnings when calling setData (with a different set of records) on the listgrid if any of its rows are expanded.

    Code:
    10:13:11.939:MUP2:WARN:ListGrid:isc_Sandbox5_1_0:findRowNum(): Attempt to find row number on dataBound grid. Target record has no primary keys. Typically this is only supported where listGrid.saveLocally is true. Specified primaryKeys are :{fldId: 1}
    10:13:11.967:MUP2:WARN:Log:com.google.gwt.core.client.JavaScriptException: (TypeError) 
     __gwt$exception: <skipped>: Cannot read property 'length' of undefined
        at isc_ListGrid__remapEmbeddedComponents(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Grids.js@7:2105)
        at isc_ListGrid_dataChanged(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Grids.js@67:1091)
        at <anonymous>(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Grids.js@342:1049)
        at observation(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@378:331)
        at isc_Arra_sortByProperties(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@46:1156)
        at isc_Arra_setSort(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@13:1129)
        at isc_ListGrid_applySortToData(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Grids.js@11:2757)
        at isc_ListGrid_setSort(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Grids.js@27:2737)
        at isc_ListGrid_setData(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Grids.js@28:978)
        at isc_Class_setProperties(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@109:346)
        at isc_Class_setProperty(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@1296:345)
        at $setProperty_1(sandbox5-0.js@10:5364)
        at $setAttribute_4(sandbox5-0.js@43:5327)
        at $setData(sandbox5-0.js@3:6056)
        at onClick_0(sandbox5-0.js@3:6762)
        at $dispatch(sandbox5-0.js@11:19439)
        at dispatch_0(sandbox5-0.js@3:19454)
        at dispatch(sandbox5-0.js@8:1426)
        at dispatchEvent_0(sandbox5-0.js@11:1549)
        at $doFire(sandbox5-0.js@9:1601)
        at $fireEvent_0(sandbox5-0.js@3:1644)
        at $fireEvent(sandbox5-0.js@5:1500)
        at $fireEvent_1(sandbox5-0.js@44:4870)
        at fireEvent_0(sandbox5-0.js@3:4885)
        at anonymous(sandbox5-0.js@11:5729)
        at apply_0(sandbox5-0.js@23:471)
        at entry0(sandbox5-0.js@16:541)
        at anonymous(sandbox5-0.js@16:515)
        at obj.click(sandbox5-0.js@17:5753)
        at isc_StatefulCanvas_handleActivate(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Foundation.js@108:230)
        at isc_StatefulCanvas_handleClick(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Foundation.js@13:231)
        at isc_c_EventHandler_bubbleEvent(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@89:1651)
        at isc_c_EventHandler_handleClick(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@50:1511)
        at isc_c_EventHandler__handleMouseUp(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@11:1496)
        at isc_c_EventHandler_handleMouseUp(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@57:1487)
        at isc_c_EventHandler_dispatch(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@108:1725)
        at eval(eval at isc__makeFunction (http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@122:76)
    The following test case can be used to reproduce the problem.

    1. Click on the "Test Data 1" button.
    2. Expand one of the rows.
    3. Click on the "Test Data 2" button.

    Code:
        public void onModuleLoad() {
            VLayout layout = new VLayout(10);
    
            DataSource testDs = new DataSource();
            testDs.setClientOnly(true);
    
            DataSourceIntegerField fldId = new DataSourceIntegerField("fldId");
            fldId.setPrimaryKey(true);
            DataSourceTextField fld1 = new DataSourceTextField("fld1");
            DataSourceIntegerField fld2 = new DataSourceIntegerField("fld2");
    
            testDs.setFields(fldId, fld1, fld2);
    
            final ListGrid grid = new ListGrid() {
                @Override
                protected Canvas getExpansionComponent(ListGridRecord record) {
                    Canvas canvas = super.getExpansionComponent(record);
                    canvas.setMargin(5);
                    return canvas;
                }
            };
            grid.setWidth(600);
            grid.setHeight(500);
            grid.setDataSource(testDs);
            grid.setSortField("fld1");
            grid.setCanExpandRecords(true);
            grid.setExpansionMode(ExpansionMode.DETAIL_FIELD);
            grid.setDetailField("fld2");
    
            ListGridField gfld1 = new ListGridField("fld1", "Field 1");
    
            grid.setFields(gfld1);
    
            layout.addMember(grid);
    
            HLayout buttonLayout = new HLayout(10);
    
            IButton testData1Button = new IButton("Test Data 1");
            testData1Button.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    grid.setData(getTestData1());
                }
            });
            buttonLayout.addMember(testData1Button);
    
            IButton testData2Button = new IButton("Test Data 2");
            testData2Button.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    grid.setData(getTestData2());
                }
            });
            buttonLayout.addMember(testData2Button);
    
            layout.addMember(buttonLayout);
    
            layout.draw();
        }
    
        private static ListGridRecord[] getTestData1() {
            ListGridRecord[] testData1 = new ListGridRecord[3];
            testData1[0] = new ListGridRecord();
            testData1[0].setAttribute("fldId", 1);
            testData1[0].setAttribute("fld1", "A");
            testData1[0].setAttribute("fld2", 10);
            testData1[1] = new ListGridRecord();
            testData1[1].setAttribute("fldId", 2);
            testData1[1].setAttribute("fld1", "B");
            testData1[1].setAttribute("fld2", 20);
            testData1[2] = new ListGridRecord();
            testData1[2].setAttribute("fldId", 3);
            testData1[2].setAttribute("fld1", "C");
            testData1[2].setAttribute("fld2", 30);
            return testData1;
        }
    
        private static ListGridRecord[] getTestData2() {
            ListGridRecord[] testData2 = new ListGridRecord[2];
            testData2[0] = new ListGridRecord();
            testData2[0].setAttribute("fldId", 1);
            testData2[0].setAttribute("fld1", "A");
            testData2[0].setAttribute("fld2", 10);
            testData2[1] = new ListGridRecord();
            testData2[1].setAttribute("fldId", 2);
            testData2[1].setAttribute("fld1", "D");
            testData2[1].setAttribute("fld2", 40);
            return testData2;
        }
    Also, should the expanded rows be preserved when switching between Test Data 1 and Test Data 2 if the primary key is the same? For example, if you click on "Test Data 1", expand "A" and then click on "Test Data 2"?

    Thanks.

    #2
    Isomorphic,

    Do you have an update on this one?

    Thanks.

    Comment


      #3
      This is assigned and in-process. Looks like it shouldn't be too hard to fix.

      Comment


        #4
        This has been fixed for builds dated March 19 and later.

        Comment


          #5
          Thanks!

          Can you confirm if expanded rows should be preserved when switching between Test Data 1 and Test Data 2 if the primary key is the same?

          Comment


            #6
            That's current behavior, yes, since it's a call to setData() but the DS is the same.

            Comment


              #7
              OK, thanks. That's how it was working in a previous build so I just wanted to confirm that it was still the expected behavior.

              Comment


                #8
                This is working after upgrading to SmartClient Version: v10.1p_2016-03-20/Pro Deployment (built 2016-03-20). Thanks!

                Comment


                  #9
                  I am getting following error on my grid while populating data:
                  Is this issue is similar to issue posted above ? In my case i do not have extended rows. I am simply clearing data and updating new data in grid. Please advice.


                  Error: (TypeError) : Cannot read property 'length' of undefined
                  Unknown.isc_ListGrid__remapEmbeddedComponents(https://134.6.27.151/bus_mgmt/sc/...ISC_Grids.js@7) Unknown.isc_ListGrid_dataChanged(https://134.6.27.151/bus_mgmt/sc/mod...C_Grids.js@165) Unknown.(https://134.6.27.151/bus_mgmt/sc/mod...C_Grids.js@258) Unknown.observation(https://134.6.27.151/bus_mgmt/sc/mod...SC_Core.js@378)
                  Unknown.isc_ResultSet__doneChangingData(https://134.6.27.151/bus_mgmt/sc/mod...aBinding.js@29) Unknown.isc_ResultSet__handleNewData(https://134.6.27.151/bus_mgmt/sc/mod...taBinding.js@6) Unknown.isc.B.push.isc.A.fetchRemoteDataReply(https://134.6.27.151/bus_mgmt/sc/mod...Binding.js@103)

                  Comment


                    #10
                    You didn't mention your version.

                    Comment


                      #11
                      If your version is 5.0 or 4.x, we've just made a change to fix this - you can try it out in builds dated August 6 - we don't see a problem in later versions.

                      Comment


                        #12
                        I am having 4.1 version.
                        Problem is I can not upgrade version due to some limitations.
                        Could it be possible to add come hack in our code, so that we can not face this issue.

                        Comment

                        Working...
                        X