ITsolutionWizard
asked on
js datatable helper.
The following item is not working and not sure why.
1. I see the result set / value, but the first row shown 'No data available in table'
2. when I click on the <th></th> and try to sort, all data is disappeared.
3. when the table is loading (it may take 10 seconds just because of the large report),
where i can add the like ajax loading animated images? or how should I handle it?
4. The paging is not working. it shows every rows (10,000).
5. when I keep refresh the webpage, it keeps adding up the rows every 10,000
Thanks
1. I see the result set / value, but the first row shown 'No data available in table'
2. when I click on the <th></th> and try to sort, all data is disappeared.
3. when the table is loading (it may take 10 seconds just because of the large report),
where i can add the like ajax loading animated images? or how should I handle it?
4. The paging is not working. it shows every rows (10,000).
5. when I keep refresh the webpage, it keeps adding up the rows every 10,000
Thanks
<table id="data-table" class="table table-bordered" width="100%">
<thead>
<tr>
<th>Row Count</th>
<th>id</th>
</tr>
</thead>
</table>
function test2() {
$(document).ready(function () {
$('#data-table').DataTable({
"paging": true,
"ordering": true,
"info": false,
"bProcessing": true,
"bDeferRender": true,
"pageLength": 50,
"scrollY": 600,
"bSort": true,
"stateSave": true
});
var tr;
var data = new Array();
var x=0;
$.ajax({
url: "/Accounting/TestMe",
type: "Post",
data: JSON.stringify(data),
dataType: 'json',
success: function (data) {
$.each(data, function (index) {
tr = tr + "<tr>";
tr = tr + "<td>" + x + "</td>";
tr = tr + "<td>" + data[index].invoiceamount + "</td>";
tr = tr + "</tr>";
x = x + 1;
});
$('#data-table').append(tr);
},
error: function (msg) { alert(msg); }
});
});
}
/Accounting/TestMe MUST return the number of rows requested and not 10k rows
ASKER
And I added export tools (excel). The button is shown, but after export, no data shown in the file.
$('#data-table').DataTable({
dom: 'Bfrtip',
buttons: ['copyHtml5', 'excelHtml5', 'pdfHtml5', 'csvHtml5'],
"paging": true,
"ordering": true,
"info": false,
"bProcessing": true,
"bDeferRender": true,
"pageLength": 50,
"scrollY": 600,
"bSort": true,
"stateSave": true
});
ASKER
and the search box is not working as well.
ASKER
leakim971: I already limited to 100 records. and all of the issue i found is still not working
Hi,
using chrome could you right click inspect and check if you have any errors
let the inspector open when doing your tests to catch is any errors...
Having so much data you should consider to use what they called server side processing
https://datatables.net/manual/server-side
using chrome could you right click inspect and check if you have any errors
let the inspector open when doing your tests to catch is any errors...
Having so much data you should consider to use what they called server side processing
https://datatables.net/manual/server-side
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.