Announcement

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

    ListGrid inside of a SplitPane - potential bug when navigating with a tree

    Hi,

    I recently upgraded to the 13.0 jar (v13.0p_2023-06-06/LGPL Development Only (built 2023-06-06)). I am seeing some odd behavior that I did not see when using the 12.1 jar.

    When using a split pane with a tree on the navigation side, clicking down (and holding it) on a Tree Node will wipe out my ListGrid on my detail pane. It looks like the list grid gets overwritten with the record from the tree node I clicked on. It happens temporarily on mousedown, but then disappears, but this behavior is having adverse effects on my click handler logic and existing code. Note that when my TreeGrid uses a data source, I don't see this issue.

    Here is an example:


    Code:
    
            final SplitPane splitPane = new SplitPane();
            final Canvas centerPanel = new Canvas();
            final TabSet tabSet = new TabSet();
            centerPanel.addChild(tabSet);
    
            Tab tab = new Tab("Demo");
            tabSet.addTab(tab);
            tabSet.setWidth100();
            tabSet.setHeight100();
    
            final TreeGrid navigationPane = new TreeGrid();
            TreeGridField nameField = new TreeGridField("Name", "Name");
    
            TreeGridField[] treeFields = new TreeGridField[1];
            treeFields[0] = nameField;
            navigationPane.setFields(treeFields);
    
            Tree tree = new Tree();
    
            TreeNode t2 = new TreeNode();
            t2.setAttribute("NodeId", "c");
            t2.setAttribute("Name", "Child 1");
    
            TreeNode t3 = new TreeNode();
            t3.setAttribute("NodeId", "d");
            t3.setAttribute("Name", "Child 2");
    
            tree.setData(new TreeNode[] { t2, t3 });
    
            navigationPane.setData(tree);
    
            navigationPane.addNodeClickHandler(new NodeClickHandler()
            {
                @Override
                public void onNodeClick(NodeClickEvent event)
                {
    
                    ListGrid test = new ListGrid();
                    ListGridField a1 = new ListGridField("Name");
                    ListGridField a2 = new ListGridField("Other");
    
                    test.setFields(a1, a2);
                    ListGridRecord r1 = new ListGridRecord();
                    r1.setAttribute("Name", "Row 1");
                    r1.setAttribute("Other", "Value 1");
    
                    ListGridRecord r2 = new ListGridRecord();
                    r2.setAttribute("Name", "Row 2");
                    r2.setAttribute("Other", "Value 2");
                    test.addData(r1);
                    test.addData(r2);
    
                    tabSet.updateTab(0, test);
                }
            });
    
            splitPane.setWidth100();
            splitPane.setHeight100();
            splitPane.setNavigationTitle("Categories");
            splitPane.setShowLeftButton(false);
            splitPane.setShowRightButton(false);
            splitPane.setBorder("1px solid blue");
            splitPane.setDetailPane(centerPanel);
            splitPane.setNavigationPane(navigationPane);
            splitPane.setListPaneTitleTemplate("${record.categoryName}");
            splitPane.setDetailPaneTitleTemplate("${index + 1} of ${totalRows}");
            return splitPane;


    Click image for larger version  Name:	sgwt.png Views:	0 Size:	19.1 KB ID:	270408
    Last edited by pablo99; 27 Jun 2023, 10:02.

    #2
    Please see the docs for SplitPane.autoNavigate:

    https://smartclient.com/smartclient-...e.autoNavigate

    We flipped the default here to "true" a few releases ago because we thought we'd eliminated every possible case where it might misfire (and added a backcompat release note).

    What's weird here is that you don't have any DataSources in this code, and autoNavigate works with DataSources - is your sample code accurate?

    Assuming it is, please still try turning autoNavigate off and report back.

    Comment


      #3
      Yes indeed. Setting autoNavigate to false fixed my issue. Thanks.

      Comment

      Working...
      X