Line breaks inside templates
Hi After upgrading to the 12.1 release the row templates logic gets ignored when they contain line-breaks.
I define the templates inside a script block e.g.
<script id="rowTemplate" type="text/x-jquery-tmpl">
<tr>
<td>
<div>$i</div>
</td>
</tr>
</script>
And referenced as follow:
rowTemplate: $("#rowTemplate").text()
It makes the templates allot neater and effortless to update than when dealing with very complex column templates, rather than having the whole template on a single line.
I am able to implement it like this if I strip the line breaks from the text like:
rowTemplate: $("#rowTemplate").html().replace(/(\r\n|\n|\r)/gm,""),
Hi there,
Thanks for the sample, I will try to have this implemented and available for you in the upcoming service release.
Sincerely,
Konstantin
I’ve reproduced the issue for you in the attached sample.
Thank you.
Christoff
Hi again Christoff,
I will create a customer case for you and developer support will assist you through isolating the issue and logging a sample for me to work with. I will implement this inside the templating engine, so you would not have to do it externally.
Thanks,
Hi Konstantin
I gave your suggestion a try and it was a nogo. I ended up using:
rowTemplate: $("#rowTemplate").html().replace(/(\r\n|\n|\r)/gm,"")
Thanks
You can use $.trim on $('#id').text(). It will do the same thing. Let me know if this works!
Thanks!