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

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -