PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/examples/netflix-request-paging/views/AppView.js

https://github.com/dgs700/backbone.paginator
JavaScript | 32 lines | 22 code | 10 blank | 0 comment | 0 complexity | 526f9ee3d62c2183ddf88326b93c3bae MD5 | raw file
Possible License(s): MIT
  1. (function ( views ) {
  2. views.AppView = Backbone.View.extend({
  3. el : '#content',
  4. initialize : function () {
  5. var tags = this.collection;
  6. tags.on('add', this.addOne, this);
  7. tags.on('reset', this.addAll, this);
  8. tags.on('all', this.render, this);
  9. tags.pager();
  10. },
  11. addAll : function () {
  12. this.$el.empty();
  13. this.collection.each (this.addOne);
  14. },
  15. addOne : function ( item ) {
  16. var view = new views.ResultView({model:item});
  17. $('#content').append(view.render().el);
  18. },
  19. render: function(){
  20. }
  21. });
  22. })( app.views );