serverside jsonp
serverside jsonp
why not work ? belowe my code
var detailsTableOpt = $('#tablePianodicaricoDetail' + rowData.CdGiro).dataTable({
'dom': 'Bfrtip',
//'data': [],
'serverSide': true,
'processing': true,
'ajax': {
type: "POST",
data: { "StringSearch": _data },
url: _url,
//contentType: "application/json; charset=utf-8",
dataType: "jsonp",
dataFilter: function (inData) {
// what is being sent back from the server (if no error)
console.log(inData);
return inData;
},
error: function (err, status) {
// what error is seen(it could be either server side or client side.
console.log('Err:' + err);
},
dataSrc: function (result) {
console.log(result);
var parseJson = $.parseJSON(result.Data);
var json = {}
json.draw = 1;
json.recordsTotal = parseJson.length;
json.recordsFiltered = parseJson.length;
json.data = result.Data;
return parseJson;
}
},
'scrollY': '50vh',
'scrollCollapse': true,
'searching': false,
'info': false,
'paging': false,
'language': {"url": "//cdn.datatables.net/plug-ins/1.10.16/i18n/Italian.json"},
'destroy': true,
'order': [],
'buttons': [
//{
// text: '<i class="fa fa-print" aria-hidden="true"></i>',
// titleAttr: 'Stampa',
// action: function (e, dt, node, config) {
// return printDetails(e, dt, node, config);
// }
//},
{
extend: 'copyHtml5',
text: '<i class="fa fa-files-o"></i>',
titleAttr: 'Copia',
},
{
extend: 'excelHtml5',
text: '<i class="fa fa-file-excel-o"></i>',
titleAttr: 'Excel',
},
{
extend: 'pdfHtml5',
text: '<i class="fa fa-file-pdf-o"></i>',
titleAttr: 'PDF',
}
],
'columns': [
{ data: "CdGiro", title: "CdGiro", className: "dt-left", visible: false, orderable: false },
{ data: "DsGiro", title: "DsGiro", className: "dt-left", visible: false, orderable: false },
{ data: "CdVettore", title: "CdVettore", className: "dt-left", visible: false, orderable: false },
{ data: "DsVettore", title: "DsVettore", className: "dt-left", visible: false, orderable: false },
{ data: "DtConsegna", title: "DtConsegna", className: "dt-left", visible: false, orderable: false },
{ data: "DtSped", title: "DtSped", className: "dt-left", visible: false, orderable: false },
{ data: "NrSped", title: "NrSped", className: "dt-center", visible: false, orderable: false },
{ data: "Sequenza", title: "Seq.", className: "dt-center", visible: true, orderable: true },
{ data: "CdCli", title: "Cliente", className: "dt-center", visible: true, orderable: false },
{ data: "RagioneSociale", title: "Ragione Sociale", className: "dt-left", visible: true, orderable: false },
{ data: "Indirizzo", title: "Indirizzo", className: "dt-left", visible: false, orderable: false },
{ data: "Localita", title: "Localita", className: "dt-left", visible: false, orderable: false },
{ data: "Provincia", title: "Provincia", className: "dt-left", visible: false, orderable: false },
{ data: "GV", title: "GV", className: "dt-right", visible: true, orderable: false, render: function (data, type, full) { return jsFunctionHideZero(data, type, full); } },
{ data: "OF", title: "OF", className: "dt-right", visible: true, orderable: false, render: function (data, type, full) { return jsFunctionHideZero(data, type, full); } },
{ data: "SG", title: "SG", className: "dt-right", visible: true, orderable: false, render: function (data, type, full) { return jsFunctionHideZero(data, type, full); } },
{ data: "PF", title: "PF", className: "dt-right", visible: true, orderable: false, render: function (data, type, full) { return jsFunctionHideZero(data, type, full); } },
{ data: "CR", title: "CR", className: "dt-right", visible: true, orderable: false, render: function (data, type, full) { return jsFunctionHideZero(data, type, full); } },
{ data: "SL", title: "SL", className: "dt-right", visible: true, orderable: false, render: function (data, type, full) { return jsFunctionHideZero(data, type, full); } },
{ data: "TotaleKg", title: "Tot. KG.", className: "dt-right", visible: true, orderable: false },
{ data: "Im", title: "Importo", className: "dt-right", visible: true, orderable: false },
],
});
Answers
Thats a lot of code to review. Without knowing what is not working and if you are getting any alert or console errors its hard to diagnose. For troubleshooting help please post a link to your page or a test case replicating the issue.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin