Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how does gmail retain the checkbox selections from page to page

in gmail if you check mark email 4 then move to different set of 50 or 25 records and mark selection 26 then both 4 and 26 are retained if you move back and forth.

How does google do this?

would it be possible to do something like this in a page that brings only 50 records and when NEXT is clicked...it again goes to DB to bring next set of 50 records.

like image 317
learn_plsql Avatar asked Sep 01 '10 18:09

learn_plsql


3 Answers

You don't technically change pages, it's all the same page, the content is just changed dynamically with JavaScript.

like image 156
user Avatar answered Nov 20 '22 14:11

user


Take a close look at the url. Only the hash part of it changes. Which means you don't really load new pages when you click things on Gmail. They just change the elements shown to you with javascript.

Similar thing could be done with page loads if you use localStorage or sessionStorage

You could do the page you're describing with Ajax techniques.

like image 33
Epeli Avatar answered Nov 20 '22 12:11

Epeli


The inner pages are most likely loaded using AJAX. Kind of like iFrames, you monitor the links that are clicked and only load the inner part of what you're after so that you aren't loading things twice...

It's possible that these are saved in JavaScript or Cookies... I would probably store them as a JavaScript array of selected checkboxes personally... depending on how much load you're already giving to the user.

like image 23
Intellix Avatar answered Nov 20 '22 12:11

Intellix