Reputation: 458
I'm using Bootgrid in my Asp.net MVC5 project to display some data:
<table id="grid-basic" class="table table-condensed table-hover table-striped">
<thead>
<tr>
<th data-column-id="id">ID</th>
<th data-column-id="name">Name</th>
<th data-column-id="actions">Actions</th>
</tr>
</thead>
<tbody>
@foreach (Test item in Model)
{
<tr>
<td>@item.Id</td>
<td>@item.Name</td>
<td>
<span class="glyphicon glyphicon-search" aria-hidden="true"></span><b>Some Text</b>
</td>
</tr>
}
</tbody>
</table>
The problem is that bootgrid removes my HTML code and not showing any icons I want to use. Does anybody know how I can use html in my cell, I couldn't find the answer in the bootgrid documentation?
Upvotes: 1
Views: 1541
Reputation: 458
Okay I found a solution that works for me: I can use data formaters:
$("#grid-basic").bootgrid({
caseSensitive: false,
columnSelection: false,
formatters: {
"commands": function (column, row) {
return '<span class="icon glyphicon input-group-addon glyphicon-search"></span>';
}
}
});
<th data-column-id="actions" data-formatter="commands">Actions</th>
Upvotes: 2