You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have the datetime-moment plugin loaded and add a moment type the dom-checkbox plugin (and maybe others) will not work properly anymore.
This is caused by the dom-monent plugin also accepting empty strings (or strings only consisting of HTML tags) as valid dates and therefor assigning a moment date type to the column. The custom data from the dom-checkbox plugin can then not be sorted anymore, because it is not a valid date format.
I see two possible fixes:
don't detect empty strings as dates
do the format detection on the output of the custom data source plugin.
The text was updated successfully, but these errors were encountered:
You might also be able to reverse the order you are adding the two plug-ins since they are checked sequentially. The ability to use datetime / moment on empty strings was added in per a feature request.
Another option would be to disable the auto type detection for the column and assign the type manually.
Changing the order didn't help. Probably because one of them is a "type detect"($.fn.dataTable.ext.type.detect) and the other a "custom data source"($.fn.dataTable.ext.order) plugin.
One could make the empty string handling optional with a third argument to the moment function.
Having columns that have empty values default to date sorting instead of normal string sorting strikes me as kind of weird, though.
Also setting "type": "num" on the column that has "sSortDataType|orderDataType": "dom-checkbox" will probably fix it. Good idea. Maybe its useful to add this to the documentation, then? Because it did took me a lot of time, to finally figure out what the culprit was.
If you have the datetime-moment plugin loaded and add a moment type the dom-checkbox plugin (and maybe others) will not work properly anymore.
This is caused by the dom-monent plugin also accepting empty strings (or strings only consisting of HTML tags) as valid dates and therefor assigning a moment date type to the column. The custom data from the dom-checkbox plugin can then not be sorted anymore, because it is not a valid date format.
I see two possible fixes:
The text was updated successfully, but these errors were encountered: