7
我想禁用排序我的表的第一行,該行看起來像JQuery的數據表:如何禁用分揀具體<tr>
<tr class="no-sort">
<td colspan="4"></td>
<td></td>
<td></td>
<td></td>
</tr>
我想禁用排序我的表的第一行,該行看起來像JQuery的數據表:如何禁用分揀具體<tr>
<tr class="no-sort">
<td colspan="4"></td>
<td></td>
<td></td>
<td></td>
</tr>
此行不添加到dipslayed數據。
代碼添加到您fnDrawCallback
添加一行在thead
,或在您tbody
的開頭:
var opts = {};
opts.fnDrawCallback = function(){
var mySpecialRow = '<tr><td>First</td><td>Second</td></tr>';
$('#mytable thead').append(mySpecialRow);
// or
$('#mytable tbody').prepend(mySpecialRow);
}
$('#mytable').dataTable(opts);
也許我錯過了一些細節:
var $tr = $('#mytable tr.no-sort');
var mySpecialRow = $tr.html();
$tr.remove();
var opts = {};
opts.fnDrawCallback = function(){
$('#mytable thead').append(mySpecialRow);
// or
$('#mytable tbody').prepend(mySpecialRow);
};
// add any other option you want
opts.sPaginationType = "full_numbers";
$('#mytable').dataTable(opts);
感謝提供這麼好的例如,但每當我正在做這個操作,它不會採取其他選項,如我需要使用「sPaginationType」:「full_numbers」選項,這是行不通的 – NARENDRA 2013-03-14 12:53:59
你可以添加任何你喜歡的選項到'opts'對象 – LeGEC 2013-03-14 13:11:05
非常感謝。 – NARENDRA 2013-03-14 13:26:41