Statesave + colreorder + columndefs COMBO PROBLEM
Statesave + colreorder + columndefs COMBO PROBLEM

I've found a bug when I use STATESAVE with COLREORDER and COLUMNDEFS:
"aaSorting": [[ 3, "desc" ]],
colReorder: true,
stateSave: true,
"columnDefs": [
{
targets: [1],
data: {
_: "1.display",
sort: "1.@data-order",
type: "1.@data-order"
}
}
]
Supposing my table has 3 columns. And second column (index = 1) has a custom ordering from columndefs.
If I change col reorder and put date birth for example in first position and reload the page, state is saved so now date birth is on first index = 0. And columndefs not work.
<table>
<thead>
<tr>
<th class="name">Name</th>
<th class="date">Date birth</th>
<th class="comment">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td data-order="2000-04-01">01/04/2000</td>
<td>text...</td>
</tr>
<tr>
<td>Doe</td>
<td data-order="2001-04-01">01/04/2001</td>
<td>text...</td>
</tr>
<tr>
<td>John</td>
<td data-order="2002-04-01">01/04/2002</td>
<td>text...</td>
</tr>
<tr>
<td>John</td>
<td data-order="2003-04-01">01/04/2003</td>
<td>text...</td>
</tr>
</tbody>
</table>
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I would try using
columnDefs.targets
with the class ofdate
instead of specifying a specific column.Kevin
Sorry for the late... so... how can i write this (instead of 1 ??):
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
ok solved: