Hi,
I’m using GridLayout and NodeTemplae with Horizontal layout of Text and Picture.
I would like to align the node info (text + picture) to RIGHT.
I used contectAligment on the node the Layout lavel and also and also alignment: go.Spot.TopRight on the Node template.
Here is the Code :
myTree = $(go.Diagram, “myTreeDiv”,
{
allowMove: false,
allowCopy: true ,
allowDelete: false,
allowHorizontalScroll: false,
// allowDragOut: false,
contentAlignment : go.Spot.TopRight,
layout:
$(go.GridLayout,
{
wrappingColumn: 1
})
});
myTree.nodeTemplate =
$(go.Node, “Horizontal”,
{
selectionAdorned: false,
defaultStretch: go.GraphObject.Horizontal,
alignment: go.Spot.TopRight
},
$(go.TextBlock,
{
font: ‘9pt Verdana, sans-serif’,
margin : 4,
textAlign: “right”,
},
new go.Binding(“text”, “name”)),
$(go.Picture,
{
width: 20, height: 20,
imageStretch: go.GraphObject.Uniform
},
new go.Binding(“source”, “source”)
)
); // end Node
// without lines
myTree.linkTemplate = $(go.Link);
myTree.alignDocument(go.Spot.Right, go.Spot.Right);
myTree.initialContentAlignment = go.Spot.Right;
var nodeDataArray = [
{ key: 0, isTreeExpanded: false, source: "icons/campus.png", name: "1" },
{ key: 1, isTreeExpanded: false, source: "icons/campus.png", name: "22" },
{ key: 2, isTreeExpanded: false, source: "icons/campus.png", name: "333" },
{ key: 3, isTreeExpanded: false, source: "icons/campus.png", name: "4444" },
{ key: 4, isTreeExpanded: false, source: "icons/campus.png", name: "55555" }
];
myTree.model = new go.TreeModel(nodeDataArray);
Yet the node data is aligned to LEFT.
Any ideas ?
By the way, if use TreeLayout, i get the same results.
Regards
Tany