简体   繁体   中英

yadcf does not seem to work at all

I am using DataTables v 1.10.16, and yadcf v 0.9.1, with a range_date filter. The column header properly displays the input boxes for the dates, however I am getting the following two issues, making it unusable:

1) The date_format param is not respected - I gave it 'mm-dd-yyyy' and it still uses '/' characters. I would actually prefer 'yyyy-mm-dd' but the docs seem to say that this is not supported.

2) The table never gets redrawn, filtering out the rows.

I am not getting any console errors.

Here is my initialization code:

$(document).on('turbolinks:load', function() {
  var dt = $('#sessions-table').DataTable({
    'order': [[1, 'desc']]
  }).on('draw.dt', function() {
    $('.delete-link').off('ajax:success');
    $('.edit-button').off('click');
    initPage();
  }); 

  yadcf.init(dt, [
    { column_number: 1, filter_type: 'range_date', date_format: 'mm-dd-yyyy' }
  ]);
});

I think I figured it out. I was using bootstrap-datepicker and this was interfering with the datepicker widget the plugin is trying to use. Removing it and using jquery-ui datepicker solves the issue.

You should check out the docs about date filtering - datepicker_type

  • datepicker_type Required: false Type: String Default value: 'jquery-ui' | Possible values: 'jquery-ui' / 'bootstrap-datetimepicker' Description: You can choose datapicker library from defined in special notes Special notes: Currently supported only jQueryUI datepicker (datepicker) and Bootstrap datepicker ( eonasdan-bootstrap-datetimepicker ) Bootstrap datepicker depends moment library. This plugin depends moment too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM