twitter-bootstrap - 如何在 Bootstrap Table 中添加 Bootstrap 按钮

标签 twitter-bootstrap bootstrap-table

如何在 Bootstrap Table 中添加 Bootstrap 按钮

最佳答案

我已经想出了解决办法。我想和大家分享。

这是我的 table :

 <table
    id="table"
    data-toggle="table"
    data-pagination="true"
    data-url="data/RegisteredVisitors.json"
    data-show-refresh="true"
    data-show-toggle="true"
    data-show-columns="true"
    data-search="true"                          
    data-show-pagination-switch="true"
    data-id-field="visitor_id"
    data-page-list="[10, 25, 50, 100, ALL]"
    data-show-footer="false">    
<thead>
<tr>    
    <th data-field="visitor_id" data-checkbox="false" >#</th>
    <th data-field="visitor_number" data-formatter="VisitorDetails">Visitor #</th>
    <th data-field="visitor_names" data-formatter="VisitorDetails" data-sortable="true">Visitor Names</th>
    <th data-field="phone_number"  data-sortable="true">Phone Number</th>
    <th data-field="matter_type"  data-sortable="true">Matter Type</th>
    <th data-field="office_name"  data-sortable="true">Office Attending</th>
    <th data-field="time_in"  data-sortable="true">Time In</th>
    <th data-field="time_out" data-sortable="true">Time Out</th>
    <th data-field="last_visit"  data-sortable="true">Last Visit</th>
    <th data-formatter="TableActions">Action</th>
</tr>
</thead>
</table>

这是我的 jQuery 函数
function TableActions (value, row, index) {
    return [
        '<a class="like" href="javascript:void(0)" title="Edit">',
        '<i class="glyphicon glyphicon-pencil"></i>',
        '</a> ',
        '<a class="danger remove" href="javascript:void(0)" data-visitorserial="'+row.visitor_id+'" data-visitornames="'+row.visitor_names+'" data-visitorid="'+row.visitor_number+'" data-toggle="modal" data-target="#VisitorDelete" title="Remove">',
        '<i class="glyphicon glyphicon-trash"></i>',
        '</a>'
    ].join('');
}

终于让它运行起来了。

关于twitter-bootstrap - 如何在 Bootstrap Table 中添加 Bootstrap 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39791568/

相关文章:

javascript - 禁用对 bootstrap-table 中的隐藏列进行排序

html - 如何在CSS中实现曲线背景?

javascript - jQuery 下拉 Bootstrap 不适用于某些情况

html - 是否可以在 div 中使用 td 元素(没有表格)?

jquery - 删除带有确认框的动态行

jquery - 添加 css 类到 tr 失败

javascript - 如果列没有数据, Bootstrap 表删除行

javascript - 无法从数据属性中提取文本

jquery - 使用 json 对象重新加载 bootstrap-table 中的数据

javascript - jQuery 单选按钮更改