我有datatable
和id, firstName, lastName, phone, updated
字段。按隱藏列排序數據表
問題:我添加到datatable
只有四個字段(ID,名字,姓氏和電話)。 Updated
字段被隱藏。
問題:如何通過updated
場排序datatable
?
我的代碼:
$('#table').dataTable({
sDom: '<"top"fi>tS',
sScrollY: ($(window).height() - 250) + "px",
bPaginate: false,
bDeferRender: true,
bAutoWidth: false,
oLanguage: {
sInfo: "Total: _TOTAL_ entities",
sEmptyTable: "No pending entities"
},
"aoColumnDefs": [
{ "iDataSort": 4, "aTargets": [ 0 ] }
],
"aoColumns": [
{ "sWidth": "10%" },
{ "sWidth": "40%" },
{ "sWidth": "30%" },
{ "sWidth": "20%" },
{ "sTitle": "updated ", "bVisible":false }
],
fnCreatedRow: function(nRow, aData, iDataIndex) {
$(nRow).attr('id', aData[0]);
}
});
table.fnAddData([id, firstName, lastName, phone, updated]);
你想排序表啓動嗎? – dcodesmith
@dcodesmith是的。但是,如果我可以隨時進行分類,這會很好。 –
好吧,表格中的更新列的位置是什麼,我知道它隱藏了,但它應該有索引 – dcodesmith