有什么方法可以以编程方式获取 yadcf 中所有已应用过滤器的列表?
Any way to programmatically get a list of all applied filters in yadcf?
有没有办法以编程方式获取 yadcf 中所有已应用过滤器的列表?类似于:
var myTable = $('#example').DataTable();
var state = yadcf.getState(myTable);
另外,我可以反其道而行之,也就是说,我能够以编程方式应用过滤器吗?类似于以下?
yadcf.setState(myTable, state);
一个用例是,当用户更新过滤器时,我希望能够将该过滤器信息存储在某处(例如 URL),以便用户可以检索它、共享它以及另一个用户可以以与先前用户看到的相似(如果不同,则完全相同)的状态查看 table。
您正在寻找 exGetColumnFilterVal and also for the exFilterColumn ,
来自文档:
- exFilterColumn
Description: Allows to trigger filter/s externally/programmatically (support ALL filter types!!!) , perfect
for showing table with pre filtered columns
Arguments: table_arg: (variable of the datatable),
array of pairs: column number String/Object with from and to, filter_value (the actual string value that we want to filter by)
Usage example: yadcf.exFilterColumn(oTable, [[0, 'Some Data 2']]); //pre filter one column
yadcf.exFilterColumn(oTable, [[0, 'Some Data 1'], [1, {from: 111, to: 1110}], [2, {from: "", to: "11/25/2014"}]]); //pre filter
several columns
yadcf.exFilterColumn(oTable, [[0, ['Some Data 1','Some Data 2']]]); // for pre filtering multi select filter you should use array
with values (or an array with single value)
- exGetColumnFilterVal
Description: Allows to retrieve column current filtered value (support ALL filter types!!!)
Arguments: table_arg: (variable of the datatable),
column number: column number from which we want the value
Usage example: yadcf.exGetColumnFilterVal(oTable,1);
Return value: String (for simple filter) / Object (for range filter) with from and to properties / Array of strings for multi_select filter
我建议您查看文档(在 yadcf js 文件中)并阅读所有 yadcf 好东西。
有没有办法以编程方式获取 yadcf 中所有已应用过滤器的列表?类似于:
var myTable = $('#example').DataTable();
var state = yadcf.getState(myTable);
另外,我可以反其道而行之,也就是说,我能够以编程方式应用过滤器吗?类似于以下?
yadcf.setState(myTable, state);
一个用例是,当用户更新过滤器时,我希望能够将该过滤器信息存储在某处(例如 URL),以便用户可以检索它、共享它以及另一个用户可以以与先前用户看到的相似(如果不同,则完全相同)的状态查看 table。
您正在寻找 exGetColumnFilterVal and also for the exFilterColumn ,
来自文档:
- exFilterColumn Description: Allows to trigger filter/s externally/programmatically (support ALL filter types!!!) , perfect for showing table with pre filtered columns Arguments: table_arg: (variable of the datatable), array of pairs: column number String/Object with from and to, filter_value (the actual string value that we want to filter by) Usage example: yadcf.exFilterColumn(oTable, [[0, 'Some Data 2']]); //pre filter one column yadcf.exFilterColumn(oTable, [[0, 'Some Data 1'], [1, {from: 111, to: 1110}], [2, {from: "", to: "11/25/2014"}]]); //pre filter several columns yadcf.exFilterColumn(oTable, [[0, ['Some Data 1','Some Data 2']]]); // for pre filtering multi select filter you should use array with values (or an array with single value)
- exGetColumnFilterVal
Description: Allows to retrieve column current filtered value (support ALL filter types!!!) Arguments: table_arg: (variable of the datatable), column number: column number from which we want the value Usage example: yadcf.exGetColumnFilterVal(oTable,1); Return value: String (for simple filter) / Object (for range filter) with from and to properties / Array of strings for multi_select filter
我建议您查看文档(在 yadcf js 文件中)并阅读所有 yadcf 好东西。