ColumnControl searchDateTime resets server-side pagination when column type changes
ColumnControl searchDateTime resets server-side pagination when column type changes
LInk to test case: https://intranet2.cimne.com/ws/demo_datatables
I’ve isolated an issue with serverSide + ColumnControl searchDateTime.
The problem appears when DataTables auto-detects a different column type between server-side pages. For example, a column may be detected as num on one page and string on another, depending on the returned data.
In my example, column nombre contains 2500 registries of only numeric value and others as string. note that going past half of the registries or just going to the last resets pagination. (this is something that happens in my prod code since i have columns with weird ids that might contain or not letters and numbers)
When that happens, DataTables triggers the columnTypes event. searchDateTime listens to that event and calls searchInput.runSearch(true), which forces a new draw().
In server-side mode, that extra draw resets paging and sends a new request with start: 0, so the table jumps back to the first page.
Fixing the affected columns with an explicit type (for example type: 'string' or type: 'num') prevents the type change and the issue disappears.
I apologise if the explanation is not clear, english is not my first languaje and I had to autotranslate my request.
my dependencies are bundled via npm and webpack so it may not be clear but i am using the nighlty build as discussed here:
https://datatables.net/forums/discussion/81852/problem-with-date-type-on-3-0-update