I want to create a table displaying db information using ejs and nodes.js.
<table class="table table-striped table-hover" id="loaded-table">
<thead>
<tr>
<th>First</th>
<th>Second</th>
<th>Third</th>
<th>Fourth</th>
<th>Fifth</th>
</tr>
</thead>
<tbody>
<% for(var i=0; i < data.length; i++) { %>
<tr>
<td> <%= data[i].prsnl_firstName %> </td>
<td> <%= data[i].prsnl_lastName %> </td>
<td> <%= data[i].prsnl_city %> </td>
<td> <%= data[i].prsnl_email %> </td>
<td> <%= data[i].prsnl_age %> </td>
</tr>
<% } %>
</tbody>
</table>
But I also want it to be sortable. Like in wikipedia, where you click on one of the th and the table is sorted by that column.
The problem is, trying to use a jquery plugin doesn't work because the table is literally none existent at the moment of executing the code.
Is there a way to do so?