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:
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();
}
}
>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
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:
we need to know what browser/version/OS you’re using
please confirm that you see left alignment in the online Showcases, using that same browser
>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:
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
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.