Link to home
Start Free TrialLog in
Avatar of dgrafx
dgrafxFlag for United States of America

asked on

datatables current page

what would be the syntax to get the current page one is on?
for example say your datatables are showing 5 pages and you are on page 3 - how do i get page 3 as a var?
AND when I navigate away from the datatables webpage - how would I load page 3 on my return to the datatables webpage?
Avatar of darren-w-
darren-w-
Flag of United Kingdom of Great Britain and Northern Ireland image

Somthing like this:

<html>
    <head>
        <title></title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script type="text/javascript">
            $(function() {
    var pathname = window.location.pathname;
    alert (pathname);
    $('body').append('<a href ="'+pathname+'">alink</a> ')
});
        </script>
    </head>
    <body></body>
</html>

Open in new window

Avatar of dgrafx

ASKER

no - i'm talking about the datatables "page" as in pagination
only the datatables area changes for next and prev links - the entire page does not reload
ASKER CERTIFIED SOLUTION
Avatar of darren-w-
darren-w-
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dgrafx

ASKER

i cant test this right now but thought i'd reply
if this saves the "page" to a cookie and then loads that same page when you come back - if navigating away - what about the filter?
does it populate the filter box and apply it as well?

thanks
Looks like it stores filter as well

Show details      Enable or disable state saving. When enabled a cookie will be used to save table display information such as pagination information, display length, filtering and sorting. As such when the end user reloads the page the display display will match what thy had previously set up.
Avatar of dgrafx

ASKER

thats awesome!
i will test that hopefully within 24 hours and get back to you

thanks
Avatar of dgrafx

ASKER

ok - looks good and thanks