Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使jquery datatable中的表行不可查找?_Jquery_Datatables - Fatal编程技术网

如何使jquery datatable中的表行不可查找?

如何使jquery datatable中的表行不可查找?,jquery,datatables,Jquery,Datatables,Am使用jQuery Datatables列出用户,并使用selectable属性选择和取消选择行。现在我有一个问题,我想使一行不可点击(即登录用户的行)。。。我该怎么做1.任何帮助都将不胜感激 $('#example tr').click( function() { } 如何对特定行禁用此功能?类似的内容?(将class=“trDisable”添加到不应具有单击功能的行) 或 我想到了两种方法 1每个()用法 2 eq()用法//我不确定这是否适用于表,也许index()会 你可以阅读这

Am使用jQuery Datatables列出用户,并使用selectable属性选择和取消选择行。现在我有一个问题,我想使一行不可点击(即登录用户的行)。。。我该怎么做1.任何帮助都将不胜感激

$('#example tr').click( function() { 

}
如何对特定行禁用此功能?

类似的内容?(将
class=“trDisable”
添加到不应具有单击功能的行)


我想到了两种方法

1每个()用法

2 eq()用法//我不确定这是否适用于表,也许index()会

你可以阅读这些问题,它们应该会有帮助


我知道这是一条旧线索,但可能会对某人有所帮助

        $('#example').on('click', 'tbody tr', function () {
            var table = $('#example').DataTable();

            // Check if any rows are selected
            if (table.row(this, { selected: true }).any()) {
                // if condition here, if not valid
                if (!condition) table.row(this).deselect();
            }
        });

是否使用复选框选择行?@Sachyn datatable的无行选择属性
$('#example tr.trDisable').click( function(e) {
    e.stopPropagation()
}
$('#example tr').each(function(i) {
    if ( i === 2 ) {//this will select third tr
      $(this).off();
    }
});
var disabledRow = $('#example tr').eq(2);//this will deactive third row
if ( contition ) {
  disabledRow.off();
}
        $('#example').on('click', 'tbody tr', function () {
            var table = $('#example').DataTable();

            // Check if any rows are selected
            if (table.row(this, { selected: true }).any()) {
                // if condition here, if not valid
                if (!condition) table.row(this).deselect();
            }
        });