Row details with html tags problem
Row details with html tags problem
xfirebg Posts: 13Questions: 3Answers: 0
Hello, I get stuck into a problem. I use summernote to store some comments in DB.
I want to display this text in "Row details".
How to render the HTML text?
For example I see it like this in the table:
<p><b>The child row can contain any data you wish, including links, images, inner tables etc.</b></p>
The child row can contain any data you wish, including links, images, inner tables etc.
Take a look at this example. In the example the format function creates the HTML output for the child rows. You just need to change this function to build the HTML you are expecting.
Hello just discover this question and fix. Just I dont understand how this fixed the issue.
'<td>' + $("<span/>").html(d.content).text()+ '</td>' +
I guess for that particular case placing the cell data in a
spandisplayed in the child row correctly. That specific solution may or may no be what you want. I add the
btags to this example:
Does this help?
To be clear in my case:
d.name = <p style="line-height: 2;"><strike>asd</strike> <span style="font-size: 18px;"></span></p>
when I use it like this:
this did not work I see the html tags
Now if I create variable:
var name = '<p style="line-height: 2;"><strike>asd</strike> <span style="font-size: 18px;"></span></p>'
and use it like this:
its working I dont see html tags.
Please can you update Kevin's test case to demonstrate this - it'll ensure we're both looking at the same thing!
@colin I don't know how to use to upload
/ajax/objects.txtin this example.
But @kthorngren didn't undestand me fully. For example
d.nameneed to have html tags in it, but he is using html tags outside the variable. Sorry for my english if you did not understand me.
For example he is using
I'm afraid I don't understand what you are looking for either. If you have the HTML in the
nameparameter, then just modify the formatter to output only that parameter instead of wrapping it in HTML?
We'd really need a test case showing what you are trying to do please.
I use summernote editor. When saving the input in DB all html markups are saved too.
I just want to render this output later. The problem is that I see the raw html when I get it from DB.
How to upload the updated
live.datatables.netto show you? Or just add yourself html tags to see...
I paste it at the top of the JS:
I updated the test case to use the data you supplied:
Sounds like you don't need to add the additional
btags in the format function. I removed those tags. Is this what you are looking for?
Oh I see...
But still I don't understand why doesn't work for me..
What exactly isn't working?
Please provide a link to a test case that shows the issue.
I can create the test case but will be very dificult to represent it because I use Postrgres and Laravel and I have other scripts running.
But now I discover when json is created, he contain this:
"name":"<p><b style="font-family: &quot;Helvetica Neue&quot;, HelveticaNeue, Verdana, Arial, Helvetica, sans-serif; font-size: 12.6px;">Doris<\/b><span style="font-family: &quot;Helvetica Neue&quot;, HelveticaNeue, Verdana, Arial, Helvetica, sans-serif; font-size: 12.6px;">&nbsp;<\/span><u style="font-family: &quot;Helvetica Neue&quot;, HelveticaNeue, Verdana, Arial, Helvetica, sans-serif; font-size: 12.6px;">Wilder<\/u><br><\/p>"
And I want to say again, using:
'<td>' + $("<span/>").html(d.name).text()+ '</td>' +
from this question the problem is gone.
Yup - looks like your data in the database is HTML encoded. I can't say why that is, but if you want that to display as HTML you'll need to decode it as you have done.
A better solution would be to track down why it is being HTML encoded in the database (assuming it is, and it isn't a read formatter doing that).