Adding a link to the loading table
3 answers
I found a mechanism for this using a "format" object. Below is an example of formatting.
function identifierFormatter(value, row, index) {
return [
'<a class="like" href="javascript:void(0)" title="Like">',
value,
'</a>'].join('');
}
Basically, to use this, it must be added as an HTML data attribute to the table header.
<th data-field="identifier" data-align="right" data-sortable="true" data-formatter="identifierFormatter">Identifier</th>
+3
source to share
Html
<table id="table_exemple" data-toggle="table" data-pagination="true" >
<thead>
<tr>
<th data-field="id">Id</th>
<th data-field="name">Nome</th>
<th data-field="action" data-formatter="ActionFormatter">Details</th>
</tr>
</thead>
<tbody></tbody>
</table>
Javascript
var bootstrap_table = $('#table_exemple');
function AddRow(obj){
bootstrap_table.bootstrapTable('insertRow', {
index: 0,
row: {
id: obj.id,
name: obj.name,
action: obj.id
}
});
}
function ActionFormatter(value) {
return '<a href="javascript:void(0)" onclick="Details('+ value +')">Details</a>';
}
function Details(id){
...
}
0
source to share