my iggrid takes in data that has line breaks but it just shows up as one line. how can I make it multi-line with respect to the line breaks?
This is my workaround :
- First, remove the FormatterFunction for desired column.
- Add a class in RowTemplate like : "<td class=\"applyMultilineFormater\">${MyColumnValue}</td>"
- Then, add a delegate to intercept the 'dataRendered' event.
$(document).delegate("#myMasterGridName", "iggriddatarendered", function (evt, ui) { $('.applyMultilineFormater').each(function () { $(this).html(MultilineFormater($(this).html())); }); }); function MultilineFormater(val) { return val.replace(/\n/g, "<br/>"); }
$(document).delegate("#myMasterGridName", "iggriddatarendered", function (evt, ui) { $('.applyMultilineFormater').each(function () { $(this).html(MultilineFormater($(this).html())); }); });
function MultilineFormater(val) { return val.replace(/\n/g, "<br/>"); }
And it works !
Feel free to correct/update my code.
Thanks.
Hello,
I have exactly the same problem. My grid displays "<br/>" instead of a real line break.
And this is due to my RowTemplate: If I remove it, the formatter works.
Can you help me ?
Regards,
Maxime DRIVET.
Hi,
Do you have template configured for the column. If you have then remove it.
If this doesn't help, can you provide a sample for me to investigate.
Best regards,Martin PavlovInfragistics, Inc.
I don't think that's the problem. I think the problem is with the HTML encoding.
The line break IS SUCESSFULLY REPLACED with the break tag. The problem is that instead of the break tag being a line break, it's displayed as "<br/>"
Hello Jessica,
My test showed that the actual serialized value in the browser is only "\n", so you should replace only "\n" and not "\r\n".
Hope this helps,Martin PavlovInfragistics, Inc.