I want to add a link to a column in bootstrap-table. How to do this?
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){ ... }
To make the entire row as clickable in this case, one can use a link <a> tag to wrap its content.
In your HTML table:
<th data-field="snum" data-formatter="LinkFormatter">Computer</th>
in your javascript:
function LinkFormatter(value, row, index) {
return "<a href='"+row.url+"'>"+value+"</a>";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With