如何为 dataTables 中的元素运行 popover?

Posted

技术标签:

【中文标题】如何为 dataTables 中的元素运行 popover?【英文标题】:How to run popover for elements inside dataTables? 【发布时间】:2017-09-15 05:17:27 【问题描述】:

我尝试为我在其上运行数据表的表中的某些元素运行引导弹出窗口。我使用此代码但不起作用。

JS:

$('#dynamic-table1').dataTable(
    "aaSorting": [
        [3, "desc"]
    ],
    "fnDrawCallback": function (oSettings) 
        $('[data-toggle="popover"]').popover();
    
);

html:

<a data-toggle="popover" title="توضیحات کاربر ارشد" data-content="Description" data-trigger="focus">

如何解决?

【问题讨论】:

【参考方案1】:

定义不起作用?我猜你把focushover 混淆了:

<a data-toggle="popover" title="توضیحات کاربر ارشد" data-content="Description" 
   data-trigger="hover">
popover
</a>

然后你的代码就可以工作了 -> http://jsfiddle.net/ehnnm5kk/

【讨论】:

【参考方案2】:

您可以在引导程序 5 中使用相同但不同的语法。

<button type="button" class="btn btn-lg btn-danger" 
    data-bs-toggle="popover" data-bs-trigger="hover focus"
    data-bs-content="And here's some amazing content. It's very engaging. Right?">
    Click to toggle popover
 </button>

【讨论】:

以上是关于如何为 dataTables 中的元素运行 popover?的主要内容,如果未能解决你的问题,请参考以下文章

如何为 DataTable 中的每一行设置/获取自定义数据

如何为 DataTable.RowChanged 事件代码设置 DataContext

如何为xib文件中的元素设置角半径

如何为 Datatable 获取正确的查询集

如何为dataTables启用多列过滤器?

如何为 jQuery DataTables 获取 JSON 的某些部分