garris / TremulaJS

TremulaJS: Picture Streams + Momentum Engine + Bézier Paths + Multi-Device
GNU General Public License v3.0
1.31k stars 82 forks source link

Filtering grid content #19

Closed klihelp closed 9 years ago

klihelp commented 9 years ago

Is there a way to filter the content?

I see on art.com integrated price, color, size filtering.

garris commented 9 years ago

Showing a filtered data set is straightforward. The way it's done is by simply sending a new filtered array as input. A simple example might be...

var input = [ objectsHere ];
tremula.refreshData(input,optionalDataAdapter); //TremulaJS paints stuff to screen

//user interacts with someFilteringParameters

var filteredInput = someFilteringMethod(input,someFilteringParameters)
tremula.refreshData(filteredInput,optionalDataAdapter); //TremulaJS paints new stuff screen

TremulaJS paints stuff to screen very very quickly (depending on array size within 50ms) so updating your data set in this way can feel very natural/persistent.

Optionally, you can also call tremula.grid.jumpObjTo(0,objectRefOrIndex); afterward to move your list to a particular scroll point to maintain UX context if necessary.

Hope this helps!

klihelp commented 9 years ago

Thank you, seems very easy:)