Quote:
Originally Posted by devnull69
Yes, it is
Two possible ways
- client side storage (Cookie or localStorage)
- server side storage (e.g. database table or file)
The server side storage should be preferred if available, because you won't be dependent on client side settings/browsers.
|
storing presentation meta on the server is preferred?
pinging a server every time i resort is preferred?
maintaining a secured server+db is preferable to a one-line localStorage call?
how would you even store the click reliably; signing in to persist a sort is preferred?
waking up an idle EDGE/3G connection for 20 seconds to sort a grid is preferred to instantly saving it with no battery impact?
relying on an internet connection being online is preferred to using something that's available 24/7?
saddling the 99% of users with cookies/localStorage/js to facilitate the tiny minority with javascript on but cookies/localstorage off is preferable?
you have some #$%&'ed up preferences me thinks...
OP:
all you need to do is set a cookie or localStorage upon the sort click, and upon pageLoad, apply the same click based on the saved value.
if you can give your headers an id, something like the following script would work:
Code:
<th onclick="localStorage.c=this.id; runTableSort('title'); " id="title"> ...
<th onclick="localStorage.c=this.id; runTableSort('date'); " id="date">...
Code:
<script>
var tag=document.getElementById(localStorage.c);
if(tag){ tag.onclick(); } </script>