dataTables保存表

时间:2016-08-15 02:30:39

标签: datatables

我有一个国际象棋游戏的数据表(http://communitychessclub.com/examine.php)(玩家,事件,结果等),用户可以点击该行并向上弹出游戏动作。但是我希望用户能够按下后退按钮并返回到上一个表中从当前游戏的链接所在的行。

有什么想法吗?

我的脚本init:

<link rel="stylesheet" href="//cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css" />
<link rel="stylesheet" href="css/dataTable.css" />
<link rel="stylesheet" href="//cdn.datatables.net/scroller/1.4.2/css/scroller.dataTables.min.css" />
<script async onload="myInit()" src="//cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script async onload="myInit()" src="//cdn.datatables.net/scroller/1.4.2/js/dataTables.scroller.min.js"></script>

<script>

$(document).ready(function() {
$('#cccr').DataTable( {

"createdRow": function(row, data, index) {$(row).attr('game', data.game);},

"search": {"search": "<?php echo ($_GET['player']); ?>"},

"deferRender": true,
"oSearch": {"sSearch": "<?php echo ($_GET['player']); ?>"},
"aaSorting": [],
"bPaginate": true,
"bLengthChange": true,
"bFilter": true,
"bSort": true,
"bInfo": true,
"sPaginationType": "full_numbers",
//"sScrollY": "24.15rem",
"responsive": true,
"bAutoWidth":true,
"autoWidth": true,
"stateSave": true,
"ajax": "assets/games.ajax",

"columns": [

{ "data": "Date", "width": "7rem", },
{ "data": "Event" },
{ "data": "ECO" },
{ "data": "White" },
{ "data": "WhiteElo" },
{ "data": "Black" },
{ "data": "BlackElo" },
{ "data": "Result" },
{ "data": "game", visible : false }
]

} );

$("#cccr").on("click", "tr", function() {
window.location.href = 'basic.php?game='+$(this).attr('game');
} );
} );

</script> 

1 个答案:

答案 0 :(得分:0)

我建议使用这个非常酷的extension。它应该让你回到你离开的同一个地方。或者,您可以随时将移动细节移动到模态对话框中......?