backbone.js - Collection fetch returns one model but response has all models -


I'm new to backbone and after fetching a collection, I can see that the server will fetch all 15 collections Success responds all 15 models in response object, but the collection is the last part of only 15 models in the object.

  var bracket_model = backbone.model. Extension ({Default: {ID: ', Name:' ', Title:' '}, urlRoot:' http://test.com/bracket/rest.php ', .....}), var Brackets Collection = Backbone.collection.andend ({url: 'http://test.com/bracket/rest.php?op=list', model: bracket model,}), bracket calling.fet ({success: function (collection, Response) {// Collections are only one model, 15 var brackets in reaction view = new brackets view ({archive: collection}};},    

< Div class = "post-text" itemprop = "text">

Try

  var bracketsView = new bracketsView ({collec Tion: response});   

or

  var BracketsView = see new brackets ({collection: collection.toJSON ()});   

I have not tested it yet, but if I remember well, both are equal.
The first parameter gives the collection object, which gives you access to different collection attributes. The second parameter 'An array In which the 'Attribute of each model in the collection hash', which is probably what you are looking for

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -