javascript - Unable to add model to backbone collection at specified index -


hi trying add model backbone collection specific index i.e. index = 0

i using following code so

updateposts: (postmodel) ->   @postscollection.add(postmodel, {at: 0}) 

however, {at: 0} did not seem take effect model still appear @ bottom of list

initial display of collection (2 items) before adding new modal:

enter image description here

after adding new 'postmodel':

enter image description here

as can see latest model text "completed 'recorded meals' today" appeared @ bottom of list instead of top.

how can resolve latest added model appear on top of list?

  • try looking @ collection object itself, in-fact adding index 0 or not.
  • try re-rendering entire collection after (to see if render item)
  • if both of fail try sorted list (info below)

https://github.com/marionettejs/backbone.marionette/wiki/adding-support-for-sorted-collections


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -