私は自分のレコードにブートストラップデータテーブルを使用しています。しかし、私がテーブルの2ページ目にいるときに、ページをリフレッシュすると、2ページ目ではなく、テーブルの1ページ目にリダイレクトされ、この問題を解決する方法がわかります。データテーブルの検索は、最新のものではなく、リフレッシュ後の最初のページに来ます。
$("#dataTablesFull, #dataTablesFull2, #dataTablesFull3, #dataTablesFull4").dataTable({
"pageLength": <?php echo getConfigValue("table_records"); ?>,
"dom": '<"top"f>rt<"bottom"><"row dt-margin"<"col-md-6"i><"col-md-6"p><"col-md-12"B>><"clear">',
"buttons": [ 'copy', 'csv', 'excel', 'pdf', 'print' ],
"oLanguage": {
"sSearch": "<i class='fa fa-search text-gray dTsearch'></i>",
"sEmptyTable": "<?php _e('No entries to show'); ?>",
"sZeroRecords": "<?php _e('Nothing found'); ?>",
"sInfo": "<?php _e('Showing'); ?> _START_ <?php _e('to'); ?> _END_ <?php _e('of'); ?> _TOTAL_ <?php _e('entries'); ?>",
"sInfoEmpty": "",
"oPaginate": {
"sNext": "<?php _e('Next'); ?>",
"sPrevious": "<?php _e('Previous'); ?>",
"sFirst": "<?php _e('First Page'); ?>",
"sLast": "<?php _e('Last Page'); ?>"
}
},
"columnDefs": [ { "orderable": false, "targets": -1 } ] }
);
$("#dataTablesFullNoOrder, #dataTablesFullNoOrder2").dataTable({
"order": [],
"pageLength": <?php echo getConfigValue("table_records"); ?>,
"dom": '<"top"f>rt<"bottom"><"row dt-margin"<"col-md-6"i><"col-md-6"p><"col-md-12"B>><"clear">',
"buttons": [ 'copy', 'csv', 'excel', 'pdf', 'print' ],
"oLanguage": {
"sSearch": "<i class='fa fa-search text-gray dTsearch'></i>",
"sEmptyTable": "<?php _e('No entries to show'); ?>",
"sZeroRecords": "<?php _e('Nothing found'); ?>",
"sInfo": "<?php _e('Showing'); ?> _START_ <?php _e('to'); ?> _END_ <?php _e('of'); ?> _TOTAL_ <?php _e('entries'); ?>",
"sInfoEmpty": "",
"oPaginate": {
"sNext": "<?php _e('Next'); ?>",
"sPrevious": "<?php _e('Previous'); ?>",
"sFirst": "<?php _e('First Page'); ?>",
"sLast": "<?php _e('Last Page'); ?>"
}
},
"columnDefs": [ { "orderable": false, "targets": -1 } ] }
);
$("#dataTablesFullDesc, #dataTablesFullDesc2").dataTable({
"order": [[ 0, "desc" ]],
"pageLength": <?php echo getConfigValue("table_records"); ?>,
"dom": '<"top"f>rt<"bottom"><"row dt-margin"<"col-md-6"i><"col-md-6"p><"col-md-12"B>><"clear">',
"buttons": [ 'copy', 'csv', 'excel', 'pdf', 'print' ],
"oLanguage": {
"sSearch": "<i class='fa fa-search text-gray dTsearch'></i>",
"sEmptyTable": "<?php _e('No entries to show'); ?>",
"sZeroRecords": "<?php _e('Nothing found'); ?>",
"sInfo": "<?php _e('Showing'); ?> _START_ <?php _e('to'); ?> _END_ <?php _e('of'); ?> _TOTAL_ <?php _e('entries'); ?>",
"sInfoEmpty": "",
"oPaginate": {
"sNext": "<?php _e('Next'); ?>",
"sPrevious": "<?php _e('Previous'); ?>",
"sFirst": "<?php _e('First Page'); ?>",
"sLast": "<?php _e('Last Page'); ?>"
}
},
"columnDefs": [ { "orderable": false, "targets": -1 } ] }
);
$("a[data-tab-destination]").on('click', function() {
var tab = $(this).attr('data-tab-destination');
$("#"+tab).click();
});
ありがとう。これを解決するために問題 –