Announcement

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

    TreeGrid name column center aligned in 15.0d

    Hi,
    While testing upgrade to SmartGWT 15.0d I noticed that TreeGrid name field is center aligned instead of left aligned as it used to be 14.1p and earlier versions.
    Here is the test case:
    Code:
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.types.TreeModelType;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.tree.Tree;
    import com.smartgwt.client.widgets.tree.TreeGrid;
    import com.smartgwt.client.widgets.tree.TreeGridField;
    import com.smartgwt.client.widgets.tree.TreeNode;
    
    public class MainEntryPoint implements EntryPoint {
    
        public void onModuleLoad() {
    
            layout();
            SC.showConsole();
        }
    
        private void layout() {
            TreeGrid testTreeGrid = new TreeGrid();
            testTreeGrid.setWidth(300);
            testTreeGrid.setHeight(300);
    
            TreeGridField nameField = new TreeGridField();
            nameField.setCanFilter(true);
            nameField.setName("name");
    
            TreeGridField seqField = new TreeGridField();
            seqField.setName("seqIndex");
            seqField.setHidden(true);
            testTreeGrid.setFields(nameField, seqField);
    
            Tree tree = new Tree();
            tree.setModelType(TreeModelType.PARENT);
            tree.setNameProperty("name");
            tree.setOpenProperty("isOpen");
            tree.setIdField("nodeID");
            tree.setParentIdField("parentNodeID");
            tree.setRootValue("root");
            tree.setShowRoot(false);
    
            TreeNode[] appMenu = new TreeNode[2];
            appMenu[0] = new TreeNode("Folder test");
            appMenu[0].setIsFolder(true);
            appMenu[1] = new TreeNode("Test");
            appMenu[1].setIsFolder(false);
            tree.setData(appMenu);
            testTreeGrid.setData(tree);
    
            testTreeGrid.draw();
        }
    }
    and 15.0d output is:
    Click image for larger version

Name:	TreeGrid_align_v15.png
Views:	50
Size:	3.9 KB
ID:	277111
    while 14.1p output is:
    Click image for larger version

Name:	TreeGrid_align_v14.png
Views:	36
Size:	4.0 KB
ID:	277112
    Any fix or workaround for this?
    Thanks,
    MichalG

    #2
    This looks like a bug that was introduced and then fixed last week. Can you get the latest and confirm?

    Comment


      #3
      Latest is still 15.0d 2026-02-06 (and this one has the issue).
      As soon as new one would by published, I will try it.
      Thanks,
      MichalG

      Comment


        #4
        New versions of 15.0d hasn't been published since 2026-02-06.
        Is something stuck?
        Thanks,
        MichalG

        Comment


          #5
          >This looks like a bug that was introduced and then fixed last week. Can you get the latest and confirm?
          Tested against 15.0d 2026-02-19 and this bug still exists.
          Thanks
          MichalG

          Comment


            #6
            Apologies, it was indeed a 15.0-only regression, which is now fixed. Please retest with tomorrow's build.

            Comment


              #7
              Just tested with 15.0d/LGPL/2026-02-27 and still see the issue.
              MichalG

              Comment


                #8
                You can see that the online Showcases (running on yesterday's build) do not have a problem.

                We've actually made no further changes since the build you're using, so you shouldn't see a problem with your test case and we don't.

                Regardless, we'll need a test case that reproduces the problem on the latest build if you're still having trouble.

                Comment


                  #9
                  This is strange, because I still have menu titles centered:
                  Click image for larger version

Name:	TreeGrid_align_v15_2026-03-03.png
Views:	22
Size:	5.7 KB
ID:	277213

                  I just print sgwt version as titles and no other changes comparing to my original example:
                  Code:
                  import com.google.gwt.core.client.EntryPoint;
                  import com.smartgwt.client.Version;
                  import com.smartgwt.client.types.TreeModelType;
                  import com.smartgwt.client.util.SC;
                  import com.smartgwt.client.widgets.tree.Tree;
                  import com.smartgwt.client.widgets.tree.TreeGrid;
                  import com.smartgwt.client.widgets.tree.TreeGridField;
                  import com.smartgwt.client.widgets.tree.TreeNode;
                  
                  public class MainEntryPoint implements EntryPoint {
                  
                      public void onModuleLoad() {
                  
                          layout();
                          SC.showConsole();
                      }
                  
                      private void layout() {
                          TreeGrid testTreeGrid = new TreeGrid();
                          testTreeGrid.setWidth(300);
                          testTreeGrid.setHeight(300);
                  
                          TreeGridField nameField = new TreeGridField();
                          nameField.setCanFilter(true);
                          nameField.setName("name");
                  
                          TreeGridField seqField = new TreeGridField();
                          seqField.setName("seqIndex");
                          seqField.setHidden(true);
                          testTreeGrid.setFields(nameField, seqField);
                  
                          Tree tree = new Tree();
                          tree.setModelType(TreeModelType.PARENT);
                          tree.setNameProperty("name");
                          tree.setOpenProperty("isOpen");
                          tree.setIdField("nodeID");
                          tree.setParentIdField("parentNodeID");
                          tree.setRootValue("root");
                          tree.setShowRoot(false);
                  
                          TreeNode[] appMenu = new TreeNode[2];
                          appMenu[0] = new TreeNode(Version.getVersion());
                          appMenu[0].setIsFolder(true);
                          appMenu[1] = new TreeNode(Version.getSCVersionNumber());
                          appMenu[1].setIsFolder(false);
                          tree.setData(appMenu);
                          testTreeGrid.setData(tree);
                  
                          testTreeGrid.draw();
                      }
                  }
                  Thanks,
                  MichalG

                  Comment


                    #10
                    We can't reproduce with this exact code. The key fix was Feb 23, which changed tree cells to display:block instead of display:flex, such that text-align:start left aligns the content.

                    It seems like the only way your results could be different would be maybe local CSS differences? Can you try using a modern skin (maybe Shiva) and getting rid of any local skinning-related changes?

                    You should be able to look into the DOM with the browser's built-in tools and see the settings we mentioned above, and if you see any other classes involved (coming from skinning customization) you'll see the influence they are having, if any.

                    Also:

                    1) we need to know what browser/version/OS you're using
                    2) please confirm that you see left alignment in the online Showcases, using that same browser

                    Comment


                      #11
                      >It seems like the only way your results could be different would be maybe local CSS differences?
                      You are right. We have got something like that in css style:
                      Code:
                      body {
                          text-align:center;
                          overflow:hidden;
                      }
                      for years, not even remember the reason...

                      I'm very sorry that I wasted your time.
                      Thanks for help.
                      MichalG

                      Comment


                        #12
                        We would recommend keeping the overflow:hidden (we recommend it in the docs).

                        As far as the center align, we basically recommended against any global setting like that, still, it's not that uncommon and some well-known CSS frameworks do add it.

                        The old TreeGrid rendering did have an explicit override to avoid a global setting like that messing up rendering, so we're re-adding that so it's bulletproof.

                        Changes will be available in tomorrow's builds.

                        Comment


                          #13
                          So I restored our original css style with overflow:hidden; center:align and tested with v15.0d_2026-03-08.
                          The issue has gone.
                          Thanks a lot.
                          MichalG

                          Comment

                          Working...
                          X