jquery - Call Javascript function when HTML table finishes loading -
i loading html table through django:
{% m in pays %} <tr> <td><center>{{ m.bid }}</center></td> <td><center>{{ m.pdate }}</center></td> <td><center>{{ m.punt }}</center></td> </tr>
after table has necessary rows filled up. want call function makes datatable.
function inittable(){ $('#pt').datatable(); }
right now, initalizing when form submits. causes try , load on empty table. want initalize after table loads
whether put script after table
{% m in pays %} <tr> <td><center>{{ m.bid }}</center></td> <td><center>{{ m.pdate }}</center></td> <td><center>{{ m.punt }}</center></td> </tr> {% endfor %} <script> function inittable(){ $('#pt').datatable(); } </script>
or put anywhere in page inside $( document ).ready()
$( document ).ready(function() { $('#pt').datatable(); });
Comments
Post a Comment