Announcement

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

    TileGrid selection lost after DataSource update

    Hello,

    I am experiencing a behaviour that seems like a bug... I have a TileGrid with a tile selected and getSelectedRecord() method returns the corresponding record for that tile.

    After an update to the DataSource that is connected to the TileGrid, the getSelectedRecord() method returns null although the selected tile retains its graphical selected status. Hence I am not sure if the selection is lost (and should not) or the method is buggy and returns null when in fact a tile is still selected.

    Using SNAPSHOT_v13.0d_2021-04-26/LGPL Development Only (built 2021-04-26)

    #2
    Can you reproduce this in one of the samples (or by minimally modifying it)? If so, we can take a look.

    Comment


      #3
      I did't try to modify the samples but here is a test case that you can use. Just select a tile and on mouse over it will log the selected tile record. After you press "Update cache" button the selected tile still appears as selected but on mouse over it is logging null for selected record. Plus if you select another tile both tiles appear as selected although I have set
      Code:
      setSelectionType(SelectionStyle.SINGLE);

      I suspect that the selection is indeed lost but from a certain reason the tile that was selected before the datasource update remains in a "selected" graphical state...
      Attached Files

      Comment


        #4
        We looked over the handling of DataBoundComponents in general, and it seems like we consistently clear selection in the case of DS.updateCaches(), so the bug here (and shown by your sample code) is just that the TileGrid's selection is not cleared visually. We've made a fix to resolve this, back to SGWT 6.1p/SC 11.1p, which should be in the nightly builds dated 2021-06-03 and beyond.

        Comment


          #5
          The updateCaches() method was used just as a fast way in this test case to show the TileGrid selection mis/behaviour. But in our application we use the processResponse() to propagate the updates from the DataSource to various components and the selection is not lost for TreeGrid or ListGrid but it is lost for TileGrid. We shall test with the new nightly builds and get back. Maybe it will also fix this problem.

          Comment


            #6
            I just updated to the latest version as per your suggestion so I can test it but now I get all sorts of focus related errors within the console and the interface is barely responsive. One such error is:

            15:57:55.104:WARN:Log:TypeError: Cannot read property 'canFocus' of undefined
            Stack from error.stack:
            [c]TabIndexManager.calculateTabIndex(<no args: exited>) on [Class TabIndexManager] @ ISC_Core.js:1908:90
            [c]TabIndexManager.getTabIndex(<no args: exited>) on [Class TabIndexManager] @ ISC_Core.js:1906:46
            Canvas.getTabIndex(<no args: exited>) on [GridBody ID:isc_PickListMenu_2_body] @ ISC_Core.js:3956:270
            Canvas.getTagStart(<no args: exited>) on [GridBody ID:isc_PickListMenu_2_body] @ ISC_Core.js:3256:235
            Canvas._insertHTML(<no args: exited>) on [GridBody ID:isc_PickListMenu_2_body] @ ISC_Core.js:3130:248
            Canvas.draw(<no args: exited>) on [GridBody ID:isc_PickListMenu_2_body] @ ISC_Core.js:3076:220
            [c]Class.invokeSuper(<no args: exited>) on [GridBody ID:isc_PickListMenu_2_body] @ ISC_Core.js:300:93
            [c]Class.Super(<no args: exited>) on [GridBody ID:isc_PickListMenu_2_body] @ ISC_Core.js:292:170
            GridRenderer.draw(<no args: exited>) on [GridBody ID:isc_PickListMenu_2_body] @ ISC_Grids.js:251:13
            [c]Class.invokeSuper(<no args: exited>) on [GridBody ID:isc_PickListMenu_2_body] @ ISC_Core.js:300:162
            GridBody.draw(<no args: exited>) on [GridBody ID:isc_PickListMenu_2_body] @ ISC_Grids.js:806:6
            Layout.layoutChildren(<no args: exited>) on [PickListMenu ID:isc_PickListMenu_2] @ ISC_Foundation.js:343:264
            ListGrid.layoutChildren(<no args: exited>) on [PickListMenu ID:isc_PickListMenu_2] @ ISC_Grids.js:1367:32
            Layout.drawChildren(<no args: exited>) on [PickListMenu ID:isc_PickListMenu_2] @ ISC_Foundation.js:252:640
            Canvas.draw(<no args: exited>) on [PickListMenu ID:isc_PickListMenu_2] @ ISC_Core.js:3076:253
            [c]Class.invokeSuper(<no args: exited>) on [PickListMenu ID:isc_PickListMenu_2] @ ISC_Core.js:300:162
            ListGrid.draw(<no args: exited>) on [PickListMenu ID:isc_PickListMenu_2] @ ISC_Grids.js:1451:621
            _3.placePickList(<no args: exited>) on [SelectItem ID:isc_SelectItem_1 name:uniqueIdField_TaskDataSource] @ ISC_Forms.js:2295:243
            _3.$19l(<no args: exited>) on [SelectItem ID:isc_SelectItem_1 name:uniqueIdField_TaskDataSource] @ ISC_Forms.js:2153:6
            _3.showPickList(<no args: exited>) on [SelectItem ID:isc_SelectItem_1 name:uniqueIdField_TaskDataSource] @ ISC_Forms.js:2152:1055
            SelectItem.showPickList(<no args: exited>) on [SelectItem ID:isc_SelectItem_1 name:uniqueIdField_TaskDataSource] @ ISC_Forms.js:2367:211
            SelectItem.showPicker(<no args: exited>) on [SelectItem ID:isc_SelectItem_1 name:uniqueIdField_TaskDataSource] @ ISC_Forms.js:2367:76
            SelectItem.handleClick(<no args: exited>) on [SelectItem ID:isc_SelectItem_1 name:uniqueIdField_TaskDataSource] @ ISC_Forms.js:2362:166
            DynamicForm.bubbleItemHandler(<no args: exited>) on [DynamicForm ID:isc_DynamicForm_1] @ ISC_Forms.js:593:10
            DynamicForm.handleItemClick(<no args: exited>) on [DynamicForm ID:isc_DynamicForm_1] @ ISC_Forms.js:599:89
            DynamicForm.handleClick(<no args: exited>) on [DynamicForm ID:isc_DynamicForm_1] @ ISC_Forms.js:594:508
            [c]EventHandler.bubbleEvent(<no args: exited>) on [Class EventHandler] @ ISC_Core.js:2479:89
            [c]EventHandler.handleClick(<no args: exited>) on [Class EventHandler] @ ISC_Core.js:2294:50
            EventHandler._handleMouseUp(<no args: exited>) on [Class EventHandler] @ ISC_Core.js:2276:11
            [c]EventHandler.handleMouseUp(<no args: exited>) on [Class EventHandler] @ ISC_Core.js:2267:57
            [c]EventHandler.dispatch(_1=>[c]EventHandler.handleMouseUp(), _2=>[object MouseEvent]) on [Class EventHandler] @ ISC_Core.js:2578:122
            HTMLDocument.eval(event=>[object MouseEvent]) @ [no file]:3:123
            Using SmartClient Version: SNAPSHOT_v13.0d_2021-06-04/LGPL Development Only (built 2021-06-04)
            Browser: Version 1.24.56 Chromium: 90.0.4430.51 (Official Build) dev (x86_64)

            Comment


              #7
              Thanks for letting us know
              We have a developer looking at this right now. We'll follow up as soon as we have any information for you

              Comment


                #8
                We're not reproducing this issue with the test case you shared above (tested against a June 4 build), and we're not seeing any obvious TabIndex / focus problems with the online 13.0 showcase, running a June 6 build: https://www.smartclient.com/smartgwt-latest/showcase
                (We tested in both Chrome and Firefox)

                Can you double check whether you see the problem with the standalone test case you shared?
                If not, could you try to put together a new standalone test case, or point us to a sample that demonstrates this problem?

                Thanks
                Isomorphic Software

                Comment


                  #9
                  The test case is working fine so the initial selection issue seems to be fixed. The errors are within our full application... We shall try to isolate the issue but we do not even know from where to start or which of the components fire the errors...

                  Comment


                    #10
                    It seems that you reach such an error if you add the same component twice. It gives an id collision warning as before and after that an "Cannot read property 'canFocus' of undefined..." error with an unstable interface. It seems we were adding by mistake a LayoutSpacer twice which still worked in previous SGWT versions but not anymore. It is a good thing to keep this in mind in case other users encounter this issue after upgrade.

                    Everything is working fine now. Many thanks for your help!

                    Comment


                      #11
                      Coming back to the original issue regarding the lost selection on update. I have modified the TestCase.
                      Steps to reproduce:
                      - Select the first row from the ListGrid and the first tile in the TileGrid. The ones with the "Charles Madigen" name.
                      - Press "Test update" button. You will see that the selection is kept within the ListGrid and a SelectionChanged event occurs but the selection is cleared on the TileGrid and no SelectionChanged event is fired. The behaviour should be the same.
                      Attached Files

                      Comment


                        #12
                        Any feedback on this? Thank you!

                        Comment


                          #13
                          The remaining issue you're seeing is because there is no documented TileGrid property paralleling ListGrid.reselectOnUpdate We will be adding that for SC/SGWT 13.0. For older branches the suggestion would be to have your app code manually restore selection.

                          Comment


                            #14
                            I understand. Thank you!

                            Comment

                            Working...
                            X