SlidingPager.js 1.1 KB

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