javascript - I cant update my collection in backbone -


all running ,but when add new item collection ,the view not update collection display it. here code

app.views.contacts = backbone.view.extend({     tagname: 'tbody',      initialize: function(){         this.collection.on('sync',this.addone,this);     },      render: function(){          this.collection.each(this.addone,this);         return this;     },      addone: function(contact){         var contactview = new app.views.contact({model:contact});         this.$el.append(contactview.render().el);      }  

});

i don't know ,why sync not working

i guess have ho render items on sync event , render 1 on add event. this:

initialize: function(){   this.listento(this.collection, 'sync', this.render);   this.listento(this.collection, 'add', this.addone); }, 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

debian - 500 Error upon login into Plesk Admin - auth.php3? -