我有一个包含11列的服务器端数据表,我希望能够在搜索输入部分中搜索多个用逗号分隔的值。 我没有在互联网上找到确切的消息来源,或者我对此不够聪明。
下面是我的代码:
$(document).ready(function() {
$.fn.dataTableExt.oApi.fnPagingInfo = function(oSettings)
{
return {
"iStart": oSettings._iDisplayStart,
"iEnd": oSettings.fnDisplayEnd(),
"iLength": oSettings._iDisplayLength,
"iTotal": oSettings.fnRecordsTotal(),
"iFilteredTotal": oSettings.fnRecordsDisplay(),
"iPage": Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength),
"iTotalPages": Math.ceil(oSettings.fnRecordsDisplay() / oSettings._iDisplayLength)
};
};
var t = $("#mytable").dataTable({
initComplete: function() {
var api = this.api();
$('#mytable_filter input')
.off('.DT')
.on('keyup.DT', function(e) {
if (e.keyCode == 13) {
api.search(this.value).draw();
}
});
},
oLanguage: {
sProcessing: "<b>Sedang memproses..</b>"
},
processing: true,
serverSide: true,
ajax: {"url": "pengajuan_ktp/json", "type": "POST"},
columns: [
{
"data": "id",
"orderable": false
},
{"data": "no_reg"},
{"data": "nik"},
{"data": "nama"},
{"data": "alamat"},
{"data": "rt"},
{"data": "rw"},
{"data": "kelurahan"},
{"data": "jenis_pengajuan"},
{"data": "tgl_pengajuan"},
{
"data" : "aksi",
"orderable": false,
"className" : "text-center"
}
],
order: [[0, 'desc']],
rowCallback: function(row, data, iDisplayIndex) {
var info = this.fnPagingInfo();
var page = info.iPage;
var length = info.iLength;
var index = page * length + (iDisplayIndex + 1);
$('td:eq(0)', row).html(index);
}
});
});
有人可以帮我吗?