I have been trying to append data to a data table in jquery, data is appending to data table but data table is not working properly that means sorting, pagination, the search is not working. Even data is there in the data table but it is showing 0 records. Am trying to make all functionalities work properly, please help me on this.
<table id="newexample1">
<thead>
<tr>
<th>Name</th>
<th>Employee</th>
<th>InTime</th>
</tr>
</thead>
<tbody class="tablebody">
</tbody>
</table>
<script>
function newfunction() {
$(".tablebody").append("<tr onclick='historyfunction()'><td>Sasi Kumar</td><td>Suresh Kumar</td><td>21/06/2019 10:59:02</td></tr>");
}
</script>
<script>
$(document).ready(function() {
$('#newexample1').DataTable();
});
</script>
Am expecting a proper data table.
destroyandre-drawthe table then everything will be fine