fixedヘッダじゃなくてもヘッダにスクロール
修正箇所
datatable化するときにスクロール量に合わせて追従する処理を "initComplete": function(){...} で実行していましたが、下記のように修正してください。
"initComplete": function(){
$('.dataTables_scroll').addClass('scroll-x');
$('.scroll-fixedheader').addClass('scroll-x');
// fiexedしているときのヘッダのスクロールにあわせる
$('.scroll-fixedheader').on('scroll',function(){
if($('.scroll-fixedheader').scrollLeft() == 0){
//fixedヘッダーのコンテンツが複製とremoveを繰り返す影響でスクロールがリセットされる現象を防ぐ
return false;
}
$('.dataTables_scrollBody').scrollLeft($(this).scrollLeft());
$('.dataTables_scrollHead').scrollLeft($(this).scrollLeft());
});
// fiexedしていないときのヘッダのスクロールにあわせる
$('.dataTables_scrollHead').on('scroll',function(){
$('.dataTables_scrollBody').scrollLeft($(this).scrollLeft());
});
// datatableのtablebodyのスクロールに合わせる
$('.dataTables_scrollBody').on('scroll',function(){
$('.scroll-fixedheader').scrollLeft($(this).scrollLeft());
$('.dataTables_scrollBody').scrollLeft($(this).scrollLeft());
});
}
検索結果
注文番号 | 自社注文番号 | 得意先注文番号 | 受注日時 | ステータス | 得意先 | 店舗 | 受注金額 | 希望納期 | 受注数 | 出荷数 | 受注残数 | 出荷待ち | 在庫引当 | 予定在庫引当 | 完了取消日時 | 出荷区分 | 出荷金額 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
WS-20190807164018-98192 | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 361 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 |
Tiger Nixon | System Architect | Edinburgh | 361 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 |
Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 |
Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 |
Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 |
Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 |
Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 |
Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | Tiger Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 |