Lazy loading elements with filtering

I use Backbone.js to load 20 elements at a time on the page, getting more elements as I scroll down until there are none left on the server.

At the same time, I want the input box at the top when you enter the name, it filters the elements that match.

The problem is that if you have not scrolled to the end and selected the full set, the input filter will only match the elements that are currently on the page.

What is the best solution technically and visually to combine user interface filtering with lazy loaded elements?

EDIT: The present script here uploads all your friends to facebook, which can be very slow and interfere with other apis. I did not want to download everything at once, because the experience was delayed.

+5
source share
1 answer

When the user searches, why not reset the collection with the selection containing the filter?

Collection.fetch ({term: $ ("# search"). Val ()})

If you configure the backend API endpoint for this collection to encompass your results with params, then your collection will only contain server results that match user input.

3 , , , . , .

+1

All Articles