Tablesorter 外部搜索输入栏在 jquery 插入时失败
Tablesorter external search input bar failing on jquery insertion
我正在尝试编写一个 js 函数,它会触发在我的 table 顶部插入搜索栏,因为我有很多页面需要它,而且我讨厌重复代码。但是,这个带有 class 搜索的搜索栏是在我的 main .tablesorter js 之后执行的。
我所有触发更新的努力都失败了。我什至尝试在控制台中执行 .tablesorter 脚本,就像它在我插入输入栏之前执行的那样。如果我将外部搜索栏留在 html 中,它会非常有效,但一旦涉及 jquery,我就无法让它触发任何排序。
我想知道我是否可以向 js 发送信号以立即执行,因为我的 tablesorter 会等到页面加载...
filter_functions : {
filter_placeholder: { search : 'Search...' },
filter_saveFilters : true
},
//FOR SEARCH BAR
filter_external : '.search',
...
jQuery(".buttons-on-right").prepend
有一个内部过滤器函数 (bindSearch) 允许在 tablesorter 初始化后绑定外部搜索输入。使用方法如下:
var table = $('#mytable'),
input = $('.search');
// the third parameter (set as false) forces a new search
// on the current value of the newly added input; do not
// include the third parameter to silently add the new input
$.tablesorter.filter.bindSearch(table, input, false);
注意:外部输入 必须 具有 data-column="#"
属性才能起作用。 #
设置为从零开始的列索引,或设置为all
搜索所有列。
我正在尝试编写一个 js 函数,它会触发在我的 table 顶部插入搜索栏,因为我有很多页面需要它,而且我讨厌重复代码。但是,这个带有 class 搜索的搜索栏是在我的 main .tablesorter js 之后执行的。
我所有触发更新的努力都失败了。我什至尝试在控制台中执行 .tablesorter 脚本,就像它在我插入输入栏之前执行的那样。如果我将外部搜索栏留在 html 中,它会非常有效,但一旦涉及 jquery,我就无法让它触发任何排序。
我想知道我是否可以向 js 发送信号以立即执行,因为我的 tablesorter 会等到页面加载...
filter_functions : {
filter_placeholder: { search : 'Search...' },
filter_saveFilters : true
},
//FOR SEARCH BAR
filter_external : '.search',
...
jQuery(".buttons-on-right").prepend
有一个内部过滤器函数 (bindSearch) 允许在 tablesorter 初始化后绑定外部搜索输入。使用方法如下:
var table = $('#mytable'),
input = $('.search');
// the third parameter (set as false) forces a new search
// on the current value of the newly added input; do not
// include the third parameter to silently add the new input
$.tablesorter.filter.bindSearch(table, input, false);
注意:外部输入 必须 具有 data-column="#"
属性才能起作用。 #
设置为从零开始的列索引,或设置为all
搜索所有列。