jQuery Datatable not working when trying to popilate table from JavaScript -
i'm trying populate table javascript. problem table being populated "no data available in table" shown, , when try search or data; data disappears.
i using code. first have html table
<table id="addresstable"> <thead> <tr> <th>id</th> <th>street</th> <th>locality</th> </tr> </thead> <tbody> </tbody> </table>
the javascript code appending table:
for (var = 0; < features.length; i++) { $("#addresstable tbody").append("<tr><td>" + features[i].attributes["data"] + "</td><td>" + features[i].attributes["data"] + "</td><td>" + features[i].attributes["data"] + "</td></tr>"); }
any ideas how solve problem please? thanks
you need reinitialize datatable after updation,
for (var = 0; < features.length; i++) { $("#addresstable tbody").append("<tr><td>" + features[i].attributes["data"] + "</td><td>" + features[i].attributes["data"] + "</td><td>" + features[i].attributes["data"] + "</td></tr>"); } var otable = $("#addresstable").datatable(); otable.fndestroy(); $("#addresstable").datatable();
Comments
Post a Comment