gpt4 book ai didi

javascript - 标题排序中的 Jquery 数据表下拉过滤器

转载 作者:行者123 更新时间:2023-11-29 20:03:54 26 4
gpt4 key购买 nike

我想创建一个在其标题上带有下拉列表框的数据表,该列表框根据框中的选定列过滤要显示的行。我在这里修改了示例 column filtering example在标题中显示下拉列表框

   /* Add a select menu for each TH element in the table footer */
// $("tfoot th").each( function ( i ) {
$("thead th").each( function ( i ) {
...

它工作正常,但当我单击下拉列表框时它会执行排序。是否可以在我对下拉菜单执行操作时禁用排序,并在我单击不属于下拉菜单的单元格中的任何位置时触发排序。

谢谢。

最佳答案

$("thead th").each( function ( i ) {
this.innerHTML = fnCreateSelect( oTable.fnGetColumnData(i) );
$('select', this).change( function () {
oTable.fnFilter( $(this).val(), i );
} );
$('select', this).click( function (event) {
event.stopPropagation();
} );
} );

关于javascript - 标题排序中的 Jquery 数据表下拉过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13024277/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com