Sha256: 276f08ae5c875ae0ace31d954bac68167d4757b07789e258b19cc75ceb7ce230

Contents?: true

Size: 1.59 KB

Versions: 12

Compression:

Stored size: 1.59 KB

Contents

// ========================================================================
// SproutCore
// copyright 2006-2008 Sprout Systems, Inc.
// ========================================================================

require('views/view') ;
require('controllers/collection') ;
require('views/button/button') ;

/**

  @class

  A pagination view renders a widget for showing the total number of pages and
  for switching between them.  It includes a forward arrow, back arrow, and
  a popup.
  
  @extends SC.View
*/
SC.PaginationView = SC.View.extend({

  // ......................................
  // PROPERTIES
  
  // Bind these to the controller properties to support pagination.
  pageSize: 0,
  pageCount: 0,
  currentPage: 0,

  // This is the format string used for the page count.  Will be localized.
  currentPageString: "_%@-%@ of %@",
  
  // This is the format string used for the page popup.
  pageOptionString: "_Page %@: %@-%@",

  hasPreviousPage: function() {
    return this.get('currentPage') > 0 ;
  }.property(),
  
  hasNextPage: function() {
    return this.get('currentPage') < this.get('pageCount') ;
  }.property(),
   
  // ......................................
  // STRUCTURE

  // This is the generated element.
  emptyElement: '<div class="pagination">\
    <button class="prev">«</button>\
    <button class="page"></button>\
    <button class="next">»</button>\
  </div>',

  outlets: ['prevButton','nextButton','pageButton'],
  
  prevButton: SC.ButtonView.extend({
    action: function() { this.owner.decrementProperty('currentPage'); },
    isEnabledBinding: "*owner.hasPreviousPage"
  })
  
}) ;

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sproutcore-0.9.12 frameworks/sproutcore/views/pagination.js
sproutcore-0.9.14 frameworks/sproutcore/views/pagination.js
sproutcore-0.9.13 frameworks/sproutcore/views/pagination.js
sproutcore-0.9.15 frameworks/sproutcore/views/pagination.js
sproutcore-0.9.19 frameworks/sproutcore/views/pagination.js
sproutcore-0.9.16 frameworks/sproutcore/views/pagination.js
sproutcore-0.9.17 frameworks/sproutcore/views/pagination.js
sproutcore-0.9.18 frameworks/sproutcore/views/pagination.js
sproutcore-0.9.22 frameworks/sproutcore/views/pagination.js
sproutcore-0.9.20 frameworks/sproutcore/views/pagination.js
sproutcore-0.9.23 frameworks/sproutcore/views/pagination.js
sproutcore-0.9.21 frameworks/sproutcore/views/pagination.js