将 DataTables 中的 aoData 数组与序列化形式结合起来
Combine the aoData array from DataTables with the serliazed form
我正在使用 jquery 数据 table 并希望使用 jquery.
将 aoData 与表单序列化数据结合起来
fnServerData: function(sSource, aoData, fnCallback,oSettings) {
aoData.concat( $("#frm").serializeArray());
console.log(aoData);
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": 'sSource',
"data": aoData,
"success": fnCallback
} );
}
但不合并 return 仅数据 table 的数组响应。
你能帮我看看我们该怎么做吗?
谢谢
请尝试使用此代码并告诉我
fnServerData: function(sSource, aoData, fnCallback,oSettings) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": 'sSource',
"data": $.merge(aoData,
$("#frm").serializeArray()),
"success": fnCallback
} );
}
table_obj = $('#group-table').dataTable({
"sAjaxSource": "URL Goes HEre",
fnServerData: function(sSource, aoData, fnCallback,oSettings) {
aoData.push( $("#frm").serializeObject() );
console.log(aoData);
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
},
aaSorting: [[ 1, "desc" ]],
bProcessing: true,
bServerSide: true,
processing : true,
rowCallback: function(row, data, dataIndex){
// If row ID is in list of selected row IDs
if($.inArray(data[0], rows_selected) !== -1){
$(row).find('input[type="checkbox"]').prop('checked', true);
$(row).addClass('selected');
}
},
iDisplayLength: '50',
});
table_obj = $('#group-table').dataTable({
"sAjaxSource": "URL Goes HEre",
fnServerData: function(sSource, aoData, fnCallback,oSettings) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": $.merge(aoData, $("#frm").serializeArray()),
"success": fnCallback
} );
},
aaSorting: [[ 1, "desc" ]],
bProcessing: true,
bServerSide: true,
processing : true,
rowCallback: function(row, data, dataIndex){
// If row ID is in list of selected row IDs
if($.inArray(data[0], rows_selected) !== -1){
$(row).find('input[type="checkbox"]').prop('checked', true);
$(row).addClass('selected');
}
},
iDisplayLength: '50',
});
我正在使用 jquery 数据 table 并希望使用 jquery.
将 aoData 与表单序列化数据结合起来fnServerData: function(sSource, aoData, fnCallback,oSettings) {
aoData.concat( $("#frm").serializeArray());
console.log(aoData);
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": 'sSource',
"data": aoData,
"success": fnCallback
} );
}
但不合并 return 仅数据 table 的数组响应。
你能帮我看看我们该怎么做吗?
谢谢
请尝试使用此代码并告诉我
fnServerData: function(sSource, aoData, fnCallback,oSettings) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": 'sSource',
"data": $.merge(aoData,
$("#frm").serializeArray()),
"success": fnCallback
} );
}
table_obj = $('#group-table').dataTable({
"sAjaxSource": "URL Goes HEre",
fnServerData: function(sSource, aoData, fnCallback,oSettings) {
aoData.push( $("#frm").serializeObject() );
console.log(aoData);
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
},
aaSorting: [[ 1, "desc" ]],
bProcessing: true,
bServerSide: true,
processing : true,
rowCallback: function(row, data, dataIndex){
// If row ID is in list of selected row IDs
if($.inArray(data[0], rows_selected) !== -1){
$(row).find('input[type="checkbox"]').prop('checked', true);
$(row).addClass('selected');
}
},
iDisplayLength: '50',
});
table_obj = $('#group-table').dataTable({
"sAjaxSource": "URL Goes HEre",
fnServerData: function(sSource, aoData, fnCallback,oSettings) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": $.merge(aoData, $("#frm").serializeArray()),
"success": fnCallback
} );
},
aaSorting: [[ 1, "desc" ]],
bProcessing: true,
bServerSide: true,
processing : true,
rowCallback: function(row, data, dataIndex){
// If row ID is in list of selected row IDs
if($.inArray(data[0], rows_selected) !== -1){
$(row).find('input[type="checkbox"]').prop('checked', true);
$(row).addClass('selected');
}
},
iDisplayLength: '50',
});