在YADCF中,如何重绘过滤器选项

时间:2018-11-27 04:32:52

标签: yadcf

我有五个过滤器,我希望从过滤器1中选择一个选项时,所有其他过滤器都应根据表中的当前数据更改其选项。  我也尝试了累积过滤器,但是没有用。

这是我的代码:使用ajax调用获取数据并传递给以下函数:

function applyAdditionalFilterOnDataTableUsingYADCF(tableName)
{
  var info = $('#' + tableName).DataTable().page.info();
  // $('#' + tableName).DataTable().yadcf.init([
  //var oTable= $('#' + tableName).DataTable(); 
  //yadcf.init(oTable,[
  $('#'+tableName).dataTable().yadcf([
      {column_number: 1, column_data_type: "text", html_data_type: "text",
         filter_default_label: "All",
         filter_type: "multi_select",
         filter_container_id: "sch",
         filter_reset_button_text: false},

      {column_number: 2, column_data_type: "text", html_data_type: "text",
        filter_default_label: "SA", filter_type: "multi_select",
        filter_container_id: "SAC",
        filter_reset_button_text: false},

      {column_number: 5, column_data_type: "text", html_data_type: "text",
        filter_default_label: "Status", filter_type: "multi_select",
        filter_container_id: "status_container",
        filter_reset_button_text: false},

      {column_number: 7, column_data_type: "text", html_data_type: "text",
        filter_default_label: "Status", filter_type: "multi_select",
        filter_container_id: "gender_container",
        filter_reset_button_text: false},

      {column_number: 8, column_data_type: "text", html_data_type: "text",
        filter_default_label: "State", filter_type: "multi_select",
        filter_container_id: "state_container",
        filter_reset_button_text: false}

    ],
    {
       cumulative_filtering: true
    }
  );
}

0 个答案:

没有答案