sto facendo l'elaborazione lato server utilizzando jQuery datatable.My codice DataTable è come di seguito:esportare tutti i dati della tabella utilizzando jQuery DataTable TableTools
$('#DataGrid').dataTable({
destroy: true,
"processing": true,
searching: false,
serverSide: true,
"scrollX": true,
"bLengthChange": false,
"iDisplayLength": pageSize,
"bInfo": true,
//stateSave: true,
order: [
[0, "desc"]
],
"aoColumnDefs": [{
'bSortable': false,
'aTargets': [(lastColumn - 1)]
}],
"dom": 'T<"clear">lfrtip',
"tableTools": {
"aButtons": [
"copy",
"csv", "xls", "pdf"
],
"sSwfPath": $("body").attr("data-project-root") + "Content/TableTools-2.2.3/swf/copy_csv_xls_pdf.swf"
},
ajax: {
url: 'StudentProgramListForIdCardResult',
type: 'POST',
data: function(d) {
d.programId = programId;
d.sessionId = sessionId;
d.branchId = branchId;
d.campusId = campusId;
d.batchName = batchName;
d.course = course;
if ($('#paymentStatus').val() > 0) {
d.paymentStatus = $('#paymentStatus').val();
} else {
d.paymentStatus = paymentStatus;
}
if ($('#imageStatus').val() > 0) {
d.imageStatus = $('#imageStatus').val();
$('#imageStatus').val();
} else {
d.imageStatus = imageStatus;
}
if ($('#printingStatus').val() > 0) {
d.printingStatus = $('#printingStatus').val();
} else {
d.printingStatus = printingStatus;
}
d.informationViewList = informationViewList;
d.batchDays = batchDays;
d.batchTime = batchTime;
}
}
});
Ma quando ho esportare i dati, TableTools sta esportando i dati in pagina corrente. Non sta caricando tutti i dati nella tabella.
dove implementare il codice sopra? In dataTable.js o file sorgente diretto? – PoliDev
In qualsiasi file js che si sta allegando alla propria webapp. Potresti impacchettarlo come metodo e aggiungerlo al prototipo del costruttore Datatable in dataTable.js, ma probabilmente è eccessivo. Dipende da quanto di un purista OO ti capita di essere. –