I want something like .serialize() for the whole table. I am using DataTables and want to be able to get a nice nested array back.
For example, I have the following table:
<table>
<thead>
<tr>
<th>
user
</th>
<th>
first_name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
joey
</td>
</tr>
<tr>
<td>
Joey
</td>
</tr>
</tbody>
</table>
I want to be able to call a function with that table and get an array like
[
{
'user': 'joey',
'firstname':'Joey'
}
]
Is there any way to do this with the Data Tables plugin in the mix. It does some strange stuff to the table, so the functions I’ve come across don’t work on it.
I don’t know about the serialize method, but if you run out of ideas you could use this function to create your own array as the data is being processed.
So you create a global array, and in your datatable creation method you have
Sorry, my javascript is pretty awful but hopefully that can guide you in the right direction.