简体   繁体   English

yadcf似乎根本不起作用

[英]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. 我正在使用带range_date过滤器的DataTables v 1.10.16和yadcf v 0.9.1。 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. 1)不尊重date_format参数-我给它指定了'mm-dd-yyyy',它仍然使用'/'字符。 I would actually prefer 'yyyy-mm-dd' but the docs seem to say that this is not supported. 我实际上更喜欢'yyyy-mm-dd',但是文档似乎说这不受支持。

2) The table never gets redrawn, filtering out the rows. 2)该表永远不会重绘,从而过滤掉行。

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. 我使用的是bootstrap-datepicker,这干扰了插件尝试使用的datepicker小部件。 Removing it and using jquery-ui datepicker solves the issue. 删除它并使用jquery-ui datepicker解决了该问题。

You should check out the docs about date filtering - datepicker_type 您应该查看有关日期过滤的文档-datepicker_type

  • datepicker_type Required: false Type: String Default value: 'jquery-ui' | datepicker_type必需:false类型:String 默认值:'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. 可能的值:'jquery-ui'/'bootstrap-datetimepicker'描述:您可以从特殊说明中定义的数据选择器库中选择特殊说明:特别注意:当前仅支持jQueryUI datepickerdatepicker )和Bootstrap datepickereonasdan-bootstrap-datetimepicker )Bootstrap datepicker取决于时刻库。 This plugin depends moment too. 这个插件也取决于时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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