SlidingPager.js
上传用户:dawnssy
上传日期:2022-08-06
资源大小:9345k
文件大小:1k
源码类别:

JavaScript

开发平台:

JavaScript

  1. /*!  * Ext JS Library 3.1.0  * Copyright(c) 2006-2009 Ext JS, LLC  * licensing@extjs.com  * http://www.extjs.com/license  */ Ext.ux.SlidingPager = Ext.extend(Object, {
  2.     init : function(pbar){
  3.         Ext.each(pbar.items.getRange(2,6), function(c){
  4.             c.hide();
  5.         });
  6.         var slider = new Ext.Slider({
  7.             width: 114,
  8.             minValue: 1,
  9.             maxValue: 1,
  10.             plugins: new Ext.ux.SliderTip({
  11.                 getText : function(s){
  12.                     return String.format('Page <b>{0}</b> of <b>{1}</b>', s.value, s.maxValue);
  13.                 }
  14.             }),
  15.             listeners: {
  16.                 changecomplete: function(s, v){
  17.                     pbar.changePage(v);
  18.                 }
  19.             }
  20.         });
  21.         pbar.insert(5, slider);
  22.         pbar.on({
  23.             change: function(pb, data){
  24.                 slider.maxValue = data.pages;
  25.                 slider.setValue(data.activePage);
  26.             },
  27.             beforedestroy: function(){
  28.                 slider.destroy();
  29.             }
  30.         });
  31.     }
  32. });