1. 程式人生 > >bootstrap-table給單元格新增連結

bootstrap-table給單元格新增連結

1、html頁面

<table id="tb_table"></table>

2、js頁面

$("#tb_table").bootstrapTable({
					method: 'get', //請求方式
					url: '/order/orderList', //請求資料的URL
					... //中間的其他選擇暫時省略
					columns: [{
						field: 'oprate',
						title: '操作',
						width: 100,
						align: 'center',
						valign: 'middle',
						formatter: aFormatter //新增超連結的方法
					}]
				});

新增aFormatter的方法:

function aFormatter(value, row, index) {
				return [
					'<a href="#">連結</a>'
				].join("")
			}