7
加載jQuery數據表時,我有如下所示的代碼。如何將其他參數傳遞給AJAX調用?下面的問題和答案中建議的fnServerParams回調不起作用。也就是說,天真地使用aodata.push()
導致「push is undefined」(因爲aodata的確不是數組)。那麼做到這一點的正確方法是什麼?如何將其他參數傳遞給jQuery DataTable ajax調用?
相關問題:
- Datatables serverside. Send extra parameters asynchronously
- Understanding fnServerData in Datatables
代碼:
self.dataTable = self.dataTableContainer.DataTable({
"autoWidth": false,
"bSort": false,
"displayStart": 0,
"paging": false,
"lengthChange": false,
"processing": true,
"serverSide": true,
"dom": "<'dataTables_header dashboard_alert_history__alertHeader'i>",
"ajax": {
url: getDataUri,
error: onError,
cache: false,
"fnDrawCallback": onTableDrawn,
},
"fnDrawCallback": onTableDrawn,
"language": {
"info": resources.alarmHistory,
"infoEmpty": resources.alarmHistory,
"infoFiltered": ''
},
"columns": [
{
"data": "timestamp",
"mRender": function (data) {
return IoTApp.Helpers.Dates.localizeDate(data, 'L LTS');
},
"name": "timestamp"
},
{
"data": "deviceId",
"mRender": function (data) {
return htmlEncode(data);
},
"name": "deviceId"
},
{
"data": "ruleOutput",
"mRender": function (data) {
return htmlEncode(data);
},
"name": "ruleOutput"
},
{
"data": "value",
"mRender": function (data) {
return htmlEncode(IoTApp.Helpers.Numbers.localizeFromInvariant(data));
},
"name": "value"
},
],
"columnDefs": [
{
"targets": [0, 1, 2, 3],
"className": 'table_alertHistory_issueType',
"width": "20%"
}
],
});
謝謝你,幫我在正確的運動.. –
@EdathadanChiefakaArun我相信你的意思是「時刻」,雖然一個很好的「運動「對憲法有幫助! – Brett