我正在使用jquery,并希望在Bootstrap工具提示格式中显示jqGrid工具提示。
我正在使用选项
guiStyle: "bootstrap",
我在loadComplete()函数中设置属性
var setTooltipsOnColumnHeader = function (grid, iColumn, text) {
var thd = jQuery("thead:first", grid[0].grid.hDiv)[0];
jQuery("[data-toggle='tooltip']").tooltip();
jQuery("tr.ui-jqgrid-labels th:eq(" + iColumn + ")", thd).attr("data-toggle", "tooltip");
jQuery("tr.ui-jqgrid-labels th:eq(" + iColumn + ")", thd).attr("title", text);
setTooltipsOnColumnHeader($("#grid"), 9, "Some text is being written to add here");
这似乎工作正常,因为控制台视图显示了此源 -
<th id="grid_accountvalue" class="ui-th-column ui-th-ltr" title="Some
text is being written to add here" data-toggle="tooltip"
aria-selected="true" style="width: 125px;" data-original-title="Some text
is being written to add here">
我还添加了
<script type="text/javascript">
jQuery(document).ready(function(){
alert('fire alert');
$('[data-toggle="tooltip"]').tooltip();
});
</script>
到页面并触发警报,因此应初始化工具提示。
bootstrap.css包含在页面中。
当我将鼠标悬停在标题上时,我只是得到一个标准的工具提示?有什么想法吗?