vedmack / yadcf

Yet Another DataTables Column Filter (yadcf)
http://yadcf-showcase.appspot.com/
MIT License
731 stars 285 forks source link

Eonasdan Datetimepicker Issue on clear column filter and exResetAllFilters #539

Closed dabeedj closed 5 years ago

dabeedj commented 5 years ago

Hello I use version 0.9.3

When you select the date and then clear it with yadcf-filter-reset-button or exResetAllFilters it clears input element value only, but dtp plugin still thinks the date is selected, so next time you select the same date - no dtp change event fires and the filter doesn't apply until you change the date to another one

I've added some code:

  1. To the end of dateSelectSingle function. It can be places anywhere inside } else if (clear === 'clear') { The code is:
    var datetimepicker = $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).data('DateTimePicker');
    if (datetimepicker) datetimepicker.clear();
  2. To the case 'date': of exResetAllFilters
    var datetimepicker = $filterElement.data('DateTimePicker');
    if (datetimepicker) datetimepicker.clear();
  3. To the case 'range_date': of exResetAllFilters
    var datetimepicker = $('#' + fromId).data('DateTimePicker');
    if (datetimepicker) datetimepicker.clear();
    datetimepicker = $('#' + toId).data('DateTimePicker');
    if (datetimepicker) datetimepicker.clear();

    Now date clear works fine. Will appreciate to see the workaround in the future updates!

vedmack commented 5 years ago

@dabeedj , please provide a jsfiddle test page showing this issue