2010-05-18 33 views
1

我下載的jQuery插件的tablesorter 2.0從 http://tablesorter.com/jquery.tablesorter.zip和改性 的例子-pager.html其是的tablesorter/docs目錄jQuery插件的tablesorter 2.0怪異的行爲

我寫附加翻轉效果:

 

    $(function() { 
     $("table") 
      .tablesorter({widthFixed: true, widgets: ['zebra']}) 
      .tablesorterPager({container: $("#pager")}); 

      /** Additional code */ 
      $("tr").mouseover(function() { 
      $(this).addClass('over'); 
      }); 

      $("tr").mouseout(function() { 
      $(this).removeClass('over'); 
      }); 

      $("tr").click(function() { 
      $(this).addClass('marked'); 
      }); 

      $("tr").dblclick(function() { 
      $(this).removeClass('marked'); 
      }); 
      /** Additional code END */ 


}); 

當然並修改了主題/藍/ style.css的文件:

 
/* Additional code */ 
table.tablesorter tbody tr.odd td { 
background-color: #D1D1F0; 
} 

table.tablesorter tbody tr.even td { 
background-color: #EFDEDE; 
} 


table.tablesorter tbody tr.over td { 
background-color: #FBCA33; 
} 

table.tablesorter tbody tr.marked td { 
background-color: #FB4133; 
} 
/* Additional code END*/ 

全部•他的作品很好,但當我去更多的頁面,即頁面2 3或4 時,效果消失了!我真的很感謝你的幫助

回答

1

我解決了這個問題。

我只是調用尋呼機功能把側翻着的效果後,這裏是代碼:

$(function() { 
    $("table").tablesorter({widthFixed: true, widgets: ['zebra']}); 

      $("tr").mouseover(function() { 
      $(this).addClass('over'); 
      }); 

      $("tr").mouseout(function() { 
      $(this).removeClass('over'); 
      }); 

      $("tr").click(function() { 
      $(this).addClass('marked'); 
      }); 

      $("tr").dblclick(function() { 
      $(this).removeClass('marked'); 
      }); 

     $("table").tablesorterPager({container: $("#pager")}); 
    }); 
+0

感謝的人....你救了我很多時間: - )....我在這個問題上瘋了。 – Raja 2011-04-20 18:20:04

0

我也面臨着一個問題,當排序行着色後,越來越亂。我通過指定以下解決它:

$(#your_table).tablesorter({ 窗口小部件:[ 「斑馬」], widgetZebra:{CSS:[ 「your_odd_css」, 「your_even_css」]} });

這現在很好用。沒有着色問題。

1

只是一個供參考,如果你想點擊一個新行時刪除「標記」類先前選擇的行,你可以這樣做:

$("tr").click(function() { 
    $("tr.selected").removeClass('marked'); 
    $(this).addClass('marked'); 
});