Why number of entries dropdown getting blank and increasing after export?
Why number of entries dropdown getting blank and increasing after export?
mastersuse
Posts: 61Questions: 28Answers: 0
Description of problem: By default the page number is 10 entries but why the number of entries dropdown getting blank and increasing after export using function?
var result2 = [];
var count2 = 1;
$.each(response.not_found, function(k1, v1) {
if (v1.router != null){
var obj = {};
obj['result_not_found'] = v1.router;
obj['count2'] = count2++;
result2.push(obj);
}
});
resultTable2(result2);
function resultTable2(result2){
$('#table2').DataTable({
buttons: [{
action: function () {
exportNotFound();
},
}],
columns: [
{
"data": "result_not_found",
render: function(data, type, row) {
var a = "<table>";
a += "<tr><td><span>("+row.count2+")</span>SERVICE NO:</td><td>"+data.service_number+"</td></tr>";
a += "<tr><td>MSE ID:</td><td>"+data.mse_id+"</td></tr>";
a += "<tr><td>MSE INTERFACE:</td><td>"+data.mse_interface+"</td></tr>";
a += "<tr><td>VLAN:</td><td>"+data.vlan+"</td></tr>";
a += "<tr><td>BANDWIDTH:</td><td>"+data.bandwidth+"</td></tr>";
return a + "</table></br>";
}
}
],
});
}
function exportNotFound() { I am sure the problem is here. Not sure which line.
var BOM = "\uFEFF";
var table = $('#table2').DataTable();
var pages = table.page.info().pages;
table.page.len(-1).draw();
var html = $("#table2")[0].outerHTML;
table.page.len(pages).draw();
window.open('data:application/vnd.ms-excel,' + encodeURI(BOM + html));
}
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin