Hi,
I am currently creating a chat window in DashBoard using a multi-line parameter. The chat functionality works as expected, but it does look strange the way a multi-line param is implemented as a table. the entries are centered, but at the same time left-aligned. I did not find a way to align differently.
Is there an easy way? I attached my grid file so you can see what I mean.
Hi Vincent
Sorry for the delayed response. Your best option is probably to use a script table to inject HTML around your multiline text data - this will give you complete control over how it is rendered. The default renderer only uses enough width to display the data and centers additional lines within it - you can overcome this limitation by specify an absolute width.
Attached is a modified version of your panel that uses the script table with HTML wrapping:
Username1:
Short Text
With new Line
Username2:
Long Text with a lot written on the first line until the end of the box and a
short second line
Username1:
Username1:
Username1:
this
is
a
long
one
chatMaster
var model = {
htmlIfy: function(str)
{
return '<html><body><div style="width: 800px; text-align:center">' + str.split('&').join('&amp;').split('<').join('&lt;').split('\n').join('<br/>') + '</div></html>';
},
getRowCount: function()
{
return params.getElementCount('chatMaster');
},
getColumnCount: function()
{
return 1;
},
getValueAt: function(row, col)
{
return this.htmlIfy(params.getValue('chatMaster', row) + '');
}
};
model.model.rowCountChanged(model.getRowCount());
var listCount = params.getElementCount('chatMaster');
if (listCount == 1 && params.getValue(‘chatMaster’, 0) == “”) // If this is the first element and it has not been set yet
{
listCount = 0;
}
var newName = params.getValue(‘userName’, 0);
var newChat = params.getValue(‘userChat’, 0);
var newValue = newName + “:” + “\n” + newChat;
params.setValue(‘chatMaster’, listCount, newValue);
params.setValue(‘userChat’, 0, “”);
false
false
10,10
model
params.setAllValues('chatMaster', ['']);