1

Is there any way to set default params for filter style as below example?

 $.extend(true, $.fn.dataTable.defaults, {
        "ordering": false,
        "paging": false,
        "info": false,
        "autoWidth": false,
        "language": {
            "emptyTable": "bla bla",

        },
    });

My yadcf exapmle is as below

yadcf.init($Table,
     [{
     column_number: 0,
     filter_default_label: "Filter By Category",
     filter_container_id: "FilterContainer_Category",
     reset_button_style_class: "yadcf-bg-dark-theme",
     style_class: "custom-select"
     }]
);
Kerberos
  • 331
  • 1
  • 11
  • can you explain to what exactly do you mean by saying "default params for filter style" ? – Daniel Mar 01 '18 at 20:58
  • @Daniel mean I would like to set once this params `reset_button_style_class: "yadcf-bg-dark-theme", style_class: "custom-select"` for my whole project may be in my common js file. – Kerberos Mar 02 '18 at 06:54

1 Answers1

1

Anything that you add as a third argument to the yadcf init function will be used as a global parameters,

So you can do the following

yadcf.init(oTable, [{
    column_number: 0
  },
  {
    column_number: 3
  }
], {
  reset_button_style_class: "yadcf-bg-dark-theme",
  style_class: "custom-select"
});
Daniel
  • 36,833
  • 10
  • 119
  • 200
  • what does `oTable` mean that is global or must be defined for each table? Actually my question is simple I would like to use custom class for filter button or select – Kerberos Mar 05 '18 at 09:55
  • `oTable` is a table variable, you can set global per table not per yadcf – Daniel Mar 05 '18 at 09:58
  • That is not common setting when I use that code in my common js file, it gives me error like this `ReferenceError: oTable is not defined` I would like to use this property as `$.extend(true, $.fn.dataTable.defaults, { ...` – Kerberos Mar 05 '18 at 12:44
  • oTable is not defined means that it was defined inside a function and not globally... – Daniel Mar 05 '18 at 13:08
  • OK I think I can not set style once for all my project with pre-settings am I wrong? I must set style of filter control for every datatable separately? – Kerberos Mar 05 '18 at 13:19
  • thank you very much for your support and could you get plan this suggestion for next release? – Kerberos Mar 05 '18 at 14:19
  • you can add this as a new feature request but I'm not sure on when It will be added if at all because I don't have much spare time to add new features, but you can add a PR for it :) – Daniel Mar 05 '18 at 14:39