Firstly, I sync the collection with server, then I need to render. After this, user can press the button to shuffle data in page( e.g. list of songs ), and script must rerender all items. I wrote this:
AppCollection.on("add" , onUpdateItem );
$( document ).bind("keyup", function(e){
if( e.keyCode === 13 ) {
var shuffledCopy = AppCollection.clone().shuffle();
$("body").html("");
AppCollection.reset().add( shuffledCopy );
}
});
Maybe you know best pratice for this goal?