【发布时间】:2017-07-29 18:37:05
【问题描述】:
当你加载页面时,如果你点击一行,它会记录到控制台clicked。
但是,如果您对表格进行排序(点击表格标题),如果您尝试点击行,tr 上的点击事件不会被触发。
我正在使用这个插件:tablefixedheader
jQuery
$(document).ready(function(){
$("table.ex").fixheadertable({
caption : 'Tarefas Disponíveis',
showhide : false,
height : '265',
zebra : true,
zebraClass : 'ui-state-default',
sortable : true,
sortedColId : 0,
dateFormat : 'Y/m/d',
pager : true,
rowsPerPage : 25,
colratio : [110,150],
minColWidth : 110,
resizeCol : true
});
// problem with this click
// The event isn't triggered:
$("table.ex tr").click(function(){
console.log('clicked');
});
});
【问题讨论】:
-
链接很好,但请务必在问题本身中发布相关代码和标记。 meta.stackexchange.com/questions/118392/…
-
@T.J.Crowder 谢谢,我添加了没有被触发的事件:)
-
@T.J.Crowder 我不得不使用 jsfiddle 因为它使用了一些外部资源 (css/js)
-
@T.J.Crowder 我正在添加代码,但 thecodeparadox 比我快。再次感谢,一直在学习!
标签: jquery jquery-plugins html-table