Was*_*ace 3 jquery tablesorter highlight
我有一个表使用tablesorter插件成功排序.但是,我想突出显示特定行中特定文本字段中的文本.它有一个唯一的ID,但是当我将代码放在排序代码之后它不起作用.这是我的代码:
jQuery(document).ready(function() {
jQuery("#filetable").tablesorter({
sortList: [[3,1]],
widgets: ['zebra'],
testExtraction: "complex"
});
//my new code which doesn't work as expected
if(jQuery("#new_foldername").length > 0){
jQuery("#new_foldername").focus(function() { jQuery(this).select(); } );
}
});
Run Code Online (Sandbox Code Playgroud)
如果我在检查之后粘贴警报以查看#new_foldername是否存在,我会看到警报,并且我看到背景中突出显示的文本(因此我的代码突出显示文本有效).当我单击以关闭警报时,表格将完成排序...并且文本不再突出显示.
有什么想法可能会发生什么?
似乎排序是异步发生的.文档提供了一个名为"sortEnd"的钩子,您可能希望运行突出显示的代码.请参阅http://tablesorter.com/docs/example-triggers.html上的示例
$(document).ready(function() {
// call the tablesorter plugin, the magic happens in the markup
$("table").tablesorter();
//assign the sortStart event
$("table").bind("sortStart",function() {
$("#overlay").show();
}).bind("sortEnd",function() {
$("#overlay").hide();
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3694 次 |
| 最近记录: |