snex
snex

Reputation: 11

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' }
  ]);
});

Upvotes: 1

Views: 414

Answers (2)

Daniel
Daniel

Reputation: 37061

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.

Upvotes: 0

snex
snex

Reputation: 11

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.

Upvotes: 0

Related Questions