0
我正在使用很棒的tablesorter插件。我必须克隆原始标题,然后重新插入可滚动区域上方的克隆。jQuery触发点击事件似乎是落后一步
要在隐藏的旧表头元素上触发tablesorter插件,当用户单击可见克隆表时,我正在隐藏表上使用.trigger()
触发点击。
这里是jQuery的:
$('.w_price_assess').delegate('#quotations_clone thead th', 'click', function() {
var $cloneTh = $(this);
var $cloneThIndex = $cloneTh.index('#quotations_clone thead th');
$('#quotations thead th:eq(' + $cloneThIndex + ')').trigger('click');
var $classList =$('#quotations thead th:eq(' + $cloneThIndex + ')').attr('class').split(/\s+/);
console.log($classList);
$.each($classList, function(index, item){
if (item==='headerSortDown') {
$('#quotations_clone thead th').removeClass('headerSortUp headerSortDown');
$('#quotations_clone thead th:eq(' + $cloneThIndex + ')').addClass('headerSortDown');
} else if (item==='headerSortUp') {
$('#quotations_clone thead th').removeClass('headerSortUp headerSortDown');
$('#quotations_clone thead th:eq(' + $cloneThIndex + ')').addClass('headerSortUp');
} else {
//$('#quotations_clone thead th').removeClass('headerSortUp headerSortDown');
}
});
});
正在发生的问题是,当我第一次点击克隆个元素并不立即带回台分拣机追加到隐藏个元素的类。
我需要它在同一时间注册,我不知道如何去解决它?
基本上我需要更新克隆表的类后点击触发,因为它们不会被添加到事后。 – RyanP13 2010-10-14 15:08:55