Im using jquery.dataTables.min version1.9.2.
im creating an app that displays data from server. I need the table to be sortable and display the number of data per page depending on the desired of the user.
Here's my code:
The thing is, it'w working perfectly in Mozilla, but when I use Chrome, when I click the header, it isnt sorting and the all the data in the table is deleted, the dropdown that shows the no of entries to be shown is not displayed etc.
I think that this isnt normal, do you have any idea how to fix it?
Thank you!
im creating an app that displays data from server. I need the table to be sortable and display the number of data per page depending on the desired of the user.
Here's my code:
<table class="table table-striped table-bordered bootstrap-datatable datatable">
<thead>
<tr id="tableHeader">
<th data-i18n="tableHeader.dt"></th>
<th data-i18n="tableHeader.warning"></th>
<th data-i18n="tableHeader.malware_type"></th>
<th data-i18n="tableHeader.virus_name"></th>
<th data-i18n="tableHeader.source"></th>
<th data-i18n="tableHeader.ip_address"></th>
</tr>
</thead>
<tbody id="contents">
<script>
$.ajaxSetup({cache:false});
$.getJSON("/dataParser/parseData",function(jsondata, status)
{
if (status == "error") {
console.log("Error");
}
else if (status == "success") {
str='\0';
for(var i=0; i<jsondata.length; i++)
{
str = str + "<tr>";
str = str + "<td>" + jsondata[i]['dt'].trim() + "</td>";
str = str + '<td class="center">' + jsondata[i]['A'].trim() + "</td>";
str = str + '<td class="center">' + jsondata[i]['B'].trim() + "</td>";
str = str + '<td class="center">'+ jsondata[i]['C'].trim() + "</td>";
str = str + '<td class="center">'+ jsondata[i]['D'].trim() + "</td>";
str = str + '<td class="center">'+ jsondata[i]['E'].trim() + "</td>";
str = str + "</tr>";
}
document.getElementById("contents").innerHTML = str;
jsondata = null;
str = null;
}
});
</script>
</tbody>
</table>
The thing is, it'w working perfectly in Mozilla, but when I use Chrome, when I click the header, it isnt sorting and the all the data in the table is deleted, the dropdown that shows the no of entries to be shown is not displayed etc.
I think that this isnt normal, do you have any idea how to fix it?
Thank you!