看看使用Formatters。
创建一个列,每个单元格都包含您的$expenseID
.
确保data-column-id
在费用 ID 列标题上设置。对于此示例,我们将其设置为data-column-id="expenseId"
. data-visible-in-selection='false'
您也可以通过添加和data-visible='false'
到列标题来完全隐藏此列。
在“操作”的列标题中,您还需要通过传递来指定要使用的格式化程序data-formatter
。在这种情况下,我已经命名了格式化程序函数expenseReportEdit
,所以我们将使用data-formatter="expenseReportEdit"
.
您的表头的 HTML 标记将是这样的..
<thead>
<tr>
<th data-column-id="expenseId" data-identifier='true' data-visible-in-selection='false' data-visible='false'>Expense ID</th>
<th data-column-id="expenseActions" data-formatter="expenseReportEdit">Actions</th>
</tr>
</thead>
然后像这样创建您的格式化程序功能..
$("#yourTableId").bootgrid({
formatters: {
expenseReportEdit: function (column, row) {
return "<a href=\"expensereport.php?source=editexpenses&p_id=" + row.expenseId + "\"><button class='btn btn-primary btn-icon' type='button'><span class='zmdi zmdi-edit'></span></button></a>";
}
}
});