Set page in URL?
Set page in URL?
I've got filters and sorting being saved to and extracted from a URL so users can link directly to sorted and/or filtered tables, but the one think I have yet to solve is getting the pagination page into the url. Using cookies has not seemed to work for individual users but my ultimate goal would be to have it in the URL. Currently all the states are being saved to the URL via inputs holding values for the filters and sorting all within a form. I have jquery add the values to the URL on particular events, but i can't seem to make it work with the pagination anchors.
Is there any way to do this? I cannot post code because it's all on a local intranet. I'm using fairly basic DataTables stuff with no backend processing.
Is there any way to do this? I cannot post code because it's all on a local intranet. I'm using fairly basic DataTables stuff with no backend processing.
This discussion has been closed.
Replies
Allan
Is it possible to update the url after each ajax request to reflect the current page, without full page reload, which would defeat the point of ajax?
[code]
**my table id is "openTable"
var displayLength = $.cookie("cookieName_dLen") == null ? 20 : $.cookie("cookieName_dLen") ;
var displayStart = $.cookie("cookieName_dStart") == null ? 0 : $.cookie("cookieName_dStart") ;
$("#openTable").ready(function(){
$("openTable").dataTable({
"iDisplayLength": displayLength,
"iDisplayStart": displayStart
....etc.....
});
$("paginate_button").live("click", function(event) {
var theLen = $("select[name='openTable_length']").val();
var thePage = ($(this).text()*1-1) * theLen;
$.cookie("cookieName_dStart", thePage, {expires:90});
return false;
});
$("select[name='openTable_length']").change(function(){
$.cookie("cookieName_dLen", $("select[name='openTable_length']").valu(), {expires:90});
});
[/code]