Created
August 22, 2011 22:12
-
-
Save sumitngupta/1163766 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*jslint white: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, indent: 2, browser: true, sloppy: true */ | |
| /*global $, JST, Backbone, Pipeline, window */ | |
| Pipeline.Views.PaginatedView = Backbone.View.extend({ | |
| tagName: 'tr', | |
| className: 'pagination', | |
| initialize: function () { | |
| _.bindAll(this, 'previous', 'next', 'render'); | |
| this.collection.bind('refresh', this.render); | |
| this.initializeTemplate(); | |
| }, | |
| events: { | |
| 'click a.prev': 'previous', | |
| 'click a.next': 'next', | |
| 'click a.page': 'goToPage' | |
| }, | |
| initializeTemplate: function () { | |
| this.template = _.template(JST['shared/pagination'](this.collection.pageInfo())); | |
| }, | |
| render: function () { | |
| $(this.el).html(this.template()); | |
| return this; | |
| }, | |
| previous: function () { | |
| this.collection.previousPage(); | |
| return false; | |
| }, | |
| next: function () { | |
| this.collection.nextPage(); | |
| return false; | |
| }, | |
| goToPage: function () { | |
| console.log('this is this: '); | |
| console.log(this); | |
| this.collection.goToPage(); | |
| return false; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment