I'm building an application which should display all of the users Facebook friends. The entire list should be searchable (name) and filterable based on gender and in the future other parameters such as location.
So Imagine you go the the web page, you get your first 30 friends loaded (or whatever fits on your screen) and as you scroll, more friends will load. As soon as you type, the system will begin to search for names.
Now i'm wondering what an efficient way of doing this would be. Obviously I can't load all the friends on the page because some people have over 1000 friends and the page also displays their profile picture.
Because I need to do the filtering I'm not quite sure if I should load the entire friends object in one go and do the processing with PHP afterwards, or if I should load it asynchronously from facebook as the user scrolls down.
My ideas is to load the entire friends list, flash it in the session and grab it again when processing is required such as filtering and searching.
Would that be the way to go?