我一直在網絡上瀏覽數小時左右DataTables的保存滾動位置,但沒有任何運氣。至少不適合我的情況。DataTables保存狀態滾動位置
根據數據表,保存滾動條,我需要這行代碼的狀態:
$(document).ready(function() {
var oTable = $('#example').dataTable({
"sScrollY": "200px",
"sAjaxSource": "media/data/2500.txt",
"sDom": "frtiS",
"bDeferRender": true,
"bStateSave": true
});
});
但是因爲我沒有用,我可以分析它不工作的數據的任何文本文件。我使用PHP和MYSQL獲取表中的數組。
"bStateSave": true
確實保存了每個用戶輸入,例如過濾和排序,滾動條除外。
有誰知道如何解決這個問題?
編輯 好吧,我設法讓這個工作。看來我有些事情是真的,不應該這樣。現在,這個"sDom"
滾動作品的saveState和,但我的GUI不見了......
編輯 我開始的代碼是:
<!-- DATATABLES ENABLE INIT -->
<script>
<?php include ('js/datatables/ordernumhtml.js');?>
<?php include ('js/datatables/ordercurrency.js');?>
<?php include ('js/datatables/dataTables.scroller.min.js');?>
$(document).ready(function() {
$('#table1').dataTable({
"sDom": "frtiS",
"bDeferRender": false,
"bStateSave": true,
"bAutoWidth": true,
"bInfo": true,
"sScrollX": "100%",
"bScrollCollapse": true,
"bScrollAutoCss": true,
"bScrollInfinite": false,
"sScrollY": "350px",
"bJQueryUI": true,
"bProcessing": true,
"aoColumns": [
{ "sType": "num-html" },
{ "sType": "numeric" },
null,
null,
null,
null,
null,
null,
{ "sType": "currency" },
null,
{ "bSortable": false }
]
});
});
</script>