vedmack / yadcf

Yet Another DataTables Column Filter (yadcf)
http://yadcf-showcase.appspot.com/
MIT License
731 stars 285 forks source link

Configure globally #610

Closed bytestream closed 4 years ago

bytestream commented 4 years ago

It would be good if we could set global defaults for the configuration, particularly for language

$.fn.yadcf.defaults = {}

I think it would just be a simple case of adding $.extend({}, $.fn.yadcf.defaults, params) here https://github.com/vedmack/yadcf/blob/master/dist/jquery.dataTables.yadcf.js#L4642

vedmack commented 4 years ago

Do you mean like this (it's from the yadcf js file docs)?

* Global Parameters (per table rather than per column)
*
* Usage example yadcf.init(oTable,[{column_number : 0}, {column_number: 3}],{cumulative_filtering: true});

The third argument is being applied to all columns

bytestream commented 4 years ago

No, I mean global for every table. https://github.com/vedmack/yadcf/pull/287 requires you to set lang on every table you want to change the language? I just want to set a languages definition once and it apply to every yadcf instance.

bytestream commented 4 years ago

@vedmack will you accept a PR for this? and when is the next release expected?

I need a single place to set languages rather than

// template1.html
oTable.yadcf([/* unique column definition */], {
  language = {'select': 'Select value'}
});
// template2.html
oTable.yadcf([/* unique column defintion */], {
  language = {'select': 'Select value'}
});
vedmack commented 4 years ago

Sure, a PR is always welcomed

bytestream commented 4 years ago

Sent https://github.com/vedmack/yadcf/pull/617

vedmack commented 4 years ago

thanks! I will try to merge it when I'll find some spare time

bytestream commented 4 years ago

@vedmack sorry to ping but any chance of seeing this merged and released?