Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

How to set the text property of a textblock with a string containing "\n"?

$
0
0

@rickbraley wrote:

I need to dynamically insert a text string into a multiline textblock containing the '\n' character and have the string show up as multiple lines.
The following code does not appear to work:
var tb = n.findObject("textblock")
if(tb != null)
tb.text = t;

where t = "Line1\nLine2\nLine3" and
var n = myDiagram.findNodeForKey(id);

The textblock shows the string unbroken at the newline chars.

However, if I insert the following line in the nodeDataArray and bind it it appears correctly or if I manually insert the same string in the chrome debugger it works.

Any suggestions?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles