如何自定义 yadcf 插件以在过滤器中传递我自己的项目

How to customize yadcf plugin to pass my own items in the filter

我正在尝试将 yadcf 插件用于我的数据表中的多选插件,因为它可以灵活地 use.It 生成具有特定行中可用值的下拉多选过滤器。我想以这种方式自定义它以传递我自己的列表和对应于相同的值(列表)但不知道我该怎么做。如果有人可以指导我,我将不胜感激。

{    
    column_number: 1,
    filter_type: "multi_select",
    select_type: 'select2',
    filter_reset_button_text: false
}]);

你应该使用 data 属性

例如

{    
    column_number: 1,
    filter_type: "multi_select",
    select_type: 'select2',
    filter_reset_button_text: false,
    data: ["value1","value2"]
}

这是文档中的小片段(您最好阅读更多内容以了解 yadcf 功能)

* data
                Required:           false
                Type:               Array (of string or objects)
                Description:        When the need of predefined data for filter is needed just use an array of strings ["value1","value2"....] (supported in select / multi_select / auto_complete filters) or
                                    array of objects [{value: 'Some Data 1', label: 'One'}, {value: 'Some Data 3', label: 'Three'}] (supported in select / multi_select filters)
                Note:               that when filter_type is custom_func / multi_select_custom_func this array will populate the custom filter select element
*