How to pass or render a html in Ajax call?
How to pass or render a html in Ajax call?
Vinks_k
Posts: 1Questions: 1Answers: 0
Its is html code of Action Buttons and i want to add this html.Can you tell me please how to add this html from aoColumns:[] or any
other way?
<div class="btn-group mb-sm">
<button type="button" data-toggle="dropdown" class="btn dropdown-toggle btn-default" aria-expanded="false">Actions
<span class="caret"></span>
</button>
<ul role="menu" class="dropdown-menu">
<li><a href="#">Edit</a></li>
<li><a href="#">Watch</a></li>
<li><a href="#">Add to List</a></li>
</ul>
</div>
This discussion has been closed.
Answers
I have something almost identical, so I think I can help!
In the initialization, I use the
columns
option. If I'm not mistaken, aoColumns is the same thing, using legacy nomenclature. My columns for one of my tables looks like this:So, the first two columns contain data found in the JSON, with the keys "username" and then "homeDirectory". The third column contains action buttons like yours. So the difference with this column is that the data attribute has a null value and
defaultContent
is populated with markup. The methodfcapp.render.tools("user")
that I supply to defaultContent is just an HTML concatenator and returns a string of HTML.I also add the class "toolcell" to the entire cell in the
createdCell
callback so that I can potentially bind a click listener to the whole cell instead of the contents, as well as streamline any CSS that goes into that cell.