javascript - 如何为 jquery-bootgrid 设置工具提示

标签 javascript jquery html twitter-bootstrap laravel-4

这是我第一次实现 jquery-bootgrid。我已经使用以下代码成功实现了它。但问题是,

(1) 我无法为表头分配工具提示。

(2)如何给每列分配宽度?

感谢您的建议。

<table id="grid-basic" class="table table-striped table-bordered table-hover">
<thead>
    <tr>
        <th id="umrn" data-column-id="umrn" data-sortable="true" title="UMRN Number" data-toggle="tooltip" data-placement="top" title="Tooltip on top">UMRN</th>
        <th data-column-id="mandate_status" data-sortable="true" title="Mandate Status">Status</th>
        <th data-column-id="mandate_date" data-sortable="true">Date</th>
        <th data-column-id="payment_type"  data-sortable="true">Payment type</th>
        <!-- <th data-column-id="currency" data-sortable="true"> Currency</th> -->
        <th data-column-id="fixed_amount" data-sortable="true"> Fixed amount</th>
        <th data-column-id="max_amount" data-sortable="true"> Max amount</th>
        <!-- <th data-column-id="debtor_bank" data-sortable="true"> Debtor bank</th> -->
        <th data-column-id="creditor_bank" data-sortable="true"> Creditor bank</th>
        <th data-column-id="commands" data-formatter="commands" data-sortable="false">Options</th>
    </tr>
</thead> 
</table>
<script type="text/javascript">
  var _globalObj = {{ json_encode(array('_token'=> csrf_token())) }}
</script>

<script type="text/javascript">
  $(function () {
     $('[data-toggle="tooltip"]').tooltip();
     $('#example').tooltip(options)
  })
var token = _globalObj._token;
var grid = $("#grid-basic").bootgrid({
caseSensitive:false,
ajax: true,
post: function ()
{
    return {
        id: "b0df282a-0d67-40e5-8558-c9e93b7befed",_token:token
    };
},
url: 'getAllMandates',
formatters: {
    "commands": function(column, row)
    {
        return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.id + "\"><span class=\"fa fa-pencil\"></span></button> " ;
    }
}
}).on("loaded.rs.jquery.bootgrid", function()
{   

/* Executes after data is loaded and rendered */
grid.find(".command-edit").on("click", function(e)
{
    //alert("You pressed edit on row: " + $(this).data("row-id"));
    location.assign("mandate/"+$(this).data("row-id"));
}).end().find(".command-delete").on("click", function(e)
{
  //  alert("You pressed delete on row: " + $(this).data("row-id"));
  /*
  var recID = $(this).data("row-id");
            $.ajax({
              url: "delete_user",
              data : {'rec_id' : recID},
            }).done(function( msg ) 
            {
                loginDeleteSuccess(msg);
            }) */
});
});

最佳答案

你必须在中添加工具提示初始化命令

).on("loaded.rs.jquery.bootgrid", function()
{   
    $('[data-toggle="tooltip"]').tooltip();
}

它对我有用。

关于javascript - 如何为 jquery-bootgrid 设置工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29643510/

相关文章:

javascript - 我无法使用 AngularJS 的 $cookies.get ('key' ) 获取 cookie

javascript - 尝试编写一个 javascript 幻灯片,但图像在一段时间后不对齐

javascript - ClearInterval() 不起作用有人知道为什么吗?

滚动到某个点后 jQuery 改变背景

javascript - 比较用户输入的日期值 "instantly"

javascript - 粘性导航栏在滚动时闪烁

javascript - 如何使用 props 组件 React 发送 props

javascript - 字符串替换

javascript - 如何获取特定类的非兄弟元素的上一个和下一个元素

javascript - 查找所有 <td> 元素的数字 ID 名称