T
T
Testtest1322014-09-14 22:32:50
JavaScript
Testtest132, 2014-09-14 22:32:50

How to make proper shuffle collection in backbone?

First, I unload the models from the server into the collection and render. Then, according to the DOM event, it is necessary to mix the models in the collection and draw again, instead of the previous ones.
I googled this code on the internet:

AppCollection.on("add"  , onUpdateItem );

   $( document ).bind("keyup", function(e){
    if( e.keyCode === 13 ) {
       var shuffledCopy = AppCollection.clone().shuffle();
       $("body").html("");
       AppCollection.reset().add( shuffledCopy );
     }
   })

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2014-09-14
@k12th

Do you really need to shuffle the collection? Maybe it's enough to bring it out in a mixed form?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question