Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

daterangepicker with server side Datatables #606

Open
adrienyhuel opened this issue Dec 2, 2019 · 2 comments
Open

daterangepicker with server side Datatables #606

adrienyhuel opened this issue Dec 2, 2019 · 2 comments

Comments

@adrienyhuel
Copy link

adrienyhuel commented Dec 2, 2019

"daterangepicker" was added in #537, and this is wonderful :)

But it doesn't works really well with server side Datatables.
As it is a "date" filter_type, it send the raw value to ajax (ex : "YYYY-MM-DD - YYYY-MM-DD").

For a range of date, server side expect "YYYY-MM-DD-yadcf_delim-YYYY-MM-DD".

I modified your js this way to make it work :

function "exFilterColumn", case "date"

table_arg.fnSettings().aoPreSearchCols[column_position].sSearch = tmpStr;

if (optionsObj.datepicker_type == 'daterangepicker') {
    var [min, max] = filter_value.split(" - ");
    table_arg.fnSettings().aoPreSearchCols[column_position].sSearch = min + optionsObj.custom_range_delimiter + max;
} else {
    table_arg.fnSettings().aoPreSearchCols[column_position].sSearch = tmpStr;
}

Do you think it's the right way to make it work ?

@vedmack
Copy link
Owner

vedmack commented Dec 2, 2019

@adrienyhuel what about the case 'range_date': inside exFilterColumn function ?

@adrienyhuel
Copy link
Author

@adrienyhuel what about the case 'range_date': inside exFilterColumn function ?

@vedmack the case range_date comes with "filter_type" = "range_date", and it makes two calendars.
In order to use the "daterangepicker", we need to use only one field (and that's why in your sample, you put filter_type: "date").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants