Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a link in bootstrap-table

I want to add a link to a column in bootstrap-table. How to do this?

like image 536
Chan Avatar asked Jan 07 '15 12:01

Chan


People also ask

How do I add a link to a 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){ ... }

How do you make a whole row in a table clickable as a link?

To make the entire row as clickable in this case, one can use a link <a> tag to wrap its content.


1 Answers

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>";
}
like image 82
William Weatherby Avatar answered Oct 06 '22 00:10

William Weatherby