Reputation: 53
Having same issue as in thread below but I didn't want to comment on a 2 year old question.
yadcf - custom_select selectize bizarre behavior
I am using yadcf filter type multi select and I am trying to Initialise bootstrap_select as a custom_ select plugin. The custom select is being created fine but I am having the following issues: On page load it looks like this. When you select an option, it duplicates the two list boxes each time like this. See code below. Note: I am using the most recent version of yadcf.
var _bootstrapselect;
yadcf.initSelectPluginCustomTriggers(
function ($filterSelector) {
_bootstrapselect = $filterSelector.selectpicker({});
},
function ($filterSelector) {
_bootstrapselect.selectpicker('refresh');
},
function ($filterSelector) {
_bootstrapselect.selectpicker('destroy');
});
Is there any solution to this issue or is it yet to be resolved.
Upvotes: 1
Views: 428
Reputation: 53
I was able to solve this myself. See below for anyone trying to use bootstrap_select with yadcf custom_select.
Initialise initSelectPluginCustomTriggers like below.
var _bootstrapselect;
yadcf.initSelectPluginCustomTriggers(
function ($filterSelector) {
_bootstrapselect = $filterSelector.selectpicker({});
},
function ($filterSelector) {
_bootstrapselect.selectpicker('refresh');
},
function ($filterSelector) {
_bootstrapselect.selectpicker('destroy');
});
And for your column using multi_select, have as below:
yadcf.init(table, [
{
column_number: 0,
filter_container_id: 'external_filter_container_0',
filter_type: 'multi_select',
select_type: 'custom_select',
style_class: 'selectpicker',
filter_default_label: 'Filter Value',
filter_reset_button_text: false,
}
]);
I was just missing the style class 'selectpicker' in column 0. Silly.
See here for more bootstrap-select methods that can be used in the initSelectPluginCustomTriggers for init, refresh and destroy functions.
Upvotes: 1