I would like to retrieve iDisplaylength in a cookie
I would like to retrieve iDisplaylength in a cookie
Shiinkis
Posts: 4Questions: 0Answers: 0
Hello everybody i have a big problem ! I use datatables to display information from a database. I wish I could recover IDisplayLenght in a cookie, when we refresh page, this value is stored and used directly in the table
Here are my codes:
<script type="text/javascript">
var table_ = $('#table_d').DataTable({
fixedHeader: { header: true, footer: true },
scrollY: "calc(100vh - 480px)",
scrollCollapse: true,
paging: true,
responsive: true,
bFilter: false,
iDisplayLength: '<?php echo $memoireTableau?>',
});
</script>
$memoireTableau = isset($_COOKIE['PO_valeurTableau']) ? $_COOKIE['PO_valeurTableau'] : 100; //for datatables entries
$valeurTableau = "<script type='text/javascript'>
String sAmount = request.getParameter('iDisplayLength');
return sAmount;
}
</script>";
setcookie('PO_valeurTableau', $valeurTableau, time() + 365*24*3600, null, null, false, true );
The use of cookie officials, what bothers me is recovering iDisplayLength.
Thx and sorry for my bad english :/
This discussion has been closed.
Replies
I modify my code to :
I would strongly suggest you use the public API rather than the private settings. Specifically use
page.len()
.The private settings should never be used externally as the properties can, will and do change between versions.
Allan