Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PeopleView = Backbone.View.extend({
- initialize: function (options) {
- this.options = options;
- this.counter = 0;
- this.render();
- this.listenTo(this.collection,'reset',this.render);
- vent.on('person:search',this.search);
- },
- render: function () {
- this.$el.html('');
- this.collection.sort();
- this.collection.each(this.renderPerson, this);
- },
- renderPerson: function (person) {
- var self = this;
- this.$el.append(new PersonView({
- tagName: 'li',
- id:'p-'+person.get('id'),
- model: person,
- labels:self.options.labels
- }).el);
- },
- animate: function(){
- console.log(this.collection.length);
- this.$el.find('li').each(function(i) {
- $(this).delay(300*i).fadeOut(10, function() {
- $(this).fadeIn(300);
- });
- });
- },
- search: function(str) {
- console.log(this.collection + " hejhej");
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement