datatables - Does YADCF multi_select work with custom_select initialized via initSelectPluginCustomTriggers
问题描述
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.
解决方案
我能够自己解决这个问题。有关尝试将 bootstrap_select 与 yadcf custom_select 一起使用的任何人,请参见下文。
像下面这样初始化 initSelectPluginCustomTriggers。
var _bootstrapselect;
yadcf.initSelectPluginCustomTriggers(
function ($filterSelector) {
_bootstrapselect = $filterSelector.selectpicker({});
},
function ($filterSelector) {
_bootstrapselect.selectpicker('refresh');
},
function ($filterSelector) {
_bootstrapselect.selectpicker('destroy');
});
对于使用 multi_select 的列,如下所示:
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,
}
]);
我只是错过了第 0 列中的样式类“selectpicker”。愚蠢。
有关可在 initSelectPluginCustomTriggers 中用于初始化、刷新和销毁功能的更多引导选择方法,请参见此处。
推荐阅读
- python - sklearn simpleimputer 不会填充缺失的分类 NaN 值
- css - 如何使滚动条仅在使用时可见?
- java - 如何在java swing中获取鼠标的实时位置?
- css - 我的 css 文件(即包括我通过 CDN 的引导程序)突然停止在生产服务器上工作
- regex - 使用正则表达式在花括号内分组花括号
- ruby-on-rails - 在控制器中设计令牌身份验证并设计重复
- python - 带有 axios 的 HTTP POST:net::ERR_EMPTY_RESPONSE
- r - 尝试导入 excel 文件,显示错误消息不允许我导入
- ssh - Goland 远程调试
- c# - 将数组的一部分移动到另一个数组C#