First time using DataTables Having issues adding table data
First time using DataTables Having issues adding table data
KaidenRogers
Posts: 2Questions: 1Answers: 0
I'm using an editable DataTable from an Admin Template and when I add Table data or table headers I loose pretty much all the functionality of the table (Search, Edit, Sort, Pagination, etc)
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr class="gradeU">
<td></td>
<td></td>
<td></td>
<td class="actions">
<a href="#" class="hidden on-editing save-row"><i class="fa fa-save"></i></a>
<a href="#" class="hidden on-editing cancel-row"><i class="fa fa-times"></i></a>
<a href="#" class="on-default edit-row"><i class="fa fa-pencil"></i></a>
<a href="#" class="on-default remove-row"><i class="fa fa-trash-o"></i></a>
</td>
</tr>
This works fine
However, this doesn't:
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th><!-- extra line -->
</tr>
</thead>
<tbody>
<tr class="gradeU">
<td></td>
<td></td>
<td></td>
<td></td> <!-- extra line -->
<td class="actions">
<a href="#" class="hidden on-editing save-row"><i class="fa fa-save"></i></a>
<a href="#" class="hidden on-editing cancel-row"><i class="fa fa-times"></i></a>
<a href="#" class="on-default edit-row"><i class="fa fa-pencil"></i></a>
<a href="#" class="on-default remove-row"><i class="fa fa-trash-o"></i></a>
</td>
</tr>
I've been at this problem for hours and I can't seem to figure it out.
This discussion has been closed.
Answers
Without seeing your datatable code I would say to try checking that the columns in your html match the amount of columns you are defining in your datatables initialisation.
As well as making sure that any code you are using for <td class="actions"> is pointed to the new id of the column as you added the extra <td> before so the index of that column will of changed.
Thanks
Tom
Question answered here. Thanks anyways tom! http://stackoverflow.com/questions/37602081/adding-table-data-to-editable-datatables-removes-filters