【发布时间】:2016-02-07 08:45:44
【问题描述】:
我尝试在我的表中查找字符串并将类添加到该行。但是这段代码不起作用。只是什么都没有发生。这是我的代码,后面我调用myTable()函数:
function myTable() {
var selectDateVar = $('#selectDate').val();
var table = $('#example').DataTable( { // Таблица
"processing": true,
"serverSide": true,
"deferRender": true,
"bDestroy": true,
"sAjaxSource": "server_processing.php?data=30/09/2015",
"order": [[ 2, "desc" ]],
initComplete: function(){
var api = this.api();
new $.fn.dataTable.Buttons(api, {
buttons: [
{
extend: 'print',
text: 'Принтиране',
'className': 'btn-lg btn btn-warning printBTN',
},
]
});
api.buttons().container().appendTo( '.printButton' );
}
});
var indexes = table.rows().eq( 0 ).filter( function (rowIdx) {
return table.cell( rowIdx, 3 ).data() === '180' ? true : false;
} );
table.rows( indexes ).nodes().to$().addClass( 'highlight' );
}
我的桌子:
【问题讨论】:
-
@Spirit 是的,我确定。
标签: datatables find addclass