Sorting a Date Column when using daterangepicker on the same page
Sorting a Date Column when using daterangepicker on the same page
taylor5042
Posts: 21Questions: 6Answers: 0
I have a table that has a five columns, one of which is a date column.
This is on a page that includes the daterangepicker plugin for selecting start and end dates in a form.
The date column is very slow to sort or even times out with a script error.
If I disable daterangepicker then the date column sorts quickly.
The date format is: YYYY-MM-DD
I am not sure how to fix this, it is like I need to force datatables not to use the daterangepicker for sorting, but how?
Thanks!
This is on a page that includes the daterangepicker plugin for selecting start and end dates in a form.
The date column is very slow to sort or even times out with a script error.
If I disable daterangepicker then the date column sorts quickly.
The date format is: YYYY-MM-DD
I am not sure how to fix this, it is like I need to force datatables not to use the daterangepicker for sorting, but how?
Thanks!
This discussion has been closed.
Replies
Any Ideas?
Allan
The date range picker is used to populate a min / max date range in a form.
When the form is submitted it creates the datatable from the ajaxsource request.
I can sort on any other column without problems.
If I disable the daterangepicker plugin and hard code the min and max date fields then the table sorts quickly on the date column.
profiler shows a lot of functions from daterangepicker which are taking up most of the time.
The highest being 15% exception()
[code]
function (s) {
var mx = s.match(r);
if (mx) {
return [mx[0], s.substring(mx[0].length)];
} else {
throw new ($P.Exception)(s);
}
}
[/code]
The core of this problem seems to be related to date.js which as I understand daterangepicker is built on this.
If I disable daterangepicker, but include date.js I still have the same problem.
This has fixed the compatibility problem.