2017-02-07 53 views
0

我已經設置了大量列的數據表。目前有一個底部滾動條,但我想將一個滾動權限鏈接到數據表頂部的一個按鈕。如何在點擊事件上水平滾動數據表?

該按鈕鏈接到一個單擊事件,我發現這個jQuery示例動畫horizontal scroll right。但是,當我點擊按鈕的表不滾動水平右:

 $("#scrollXRight-btn").click(function() { 

      //$('div.dataTables_scrollBody').scrollRight($('#escalation').scrollRight() + 20); //method 1 didn't work 

      var leftPos = $('div.dataTables_scrollBody').scrollLeft(); 
      $("div.dataTables_scrollBody").animate({ scrollLeft: leftPos + 200 }, 800); 

     }); 

我也嘗試使用選擇mentioned here但動畫不火。數據表的

ID:escalation

類數據表容器:dataTables_wrapper no-footer

問:

你怎麼能水平滾動的單擊事件的DataTable?

回答