Installer/Updater
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * Ext JS Library 3.3.1
  3. * Copyright(c) 2006-2010 Sencha Inc.
  4. * licensing@sencha.com
  5. * http://www.sencha.com/license
  6. */
  7. /**
  8. * Plugin for PagingToolbar which replaces the textfield input with a slider
  9. */
  10. Ext.ux.SlidingPager = Ext.extend(Object, {
  11. init : function(pbar){
  12. var idx = pbar.items.indexOf(pbar.inputItem);
  13. Ext.each(pbar.items.getRange(idx - 2, idx + 2), function(c){
  14. c.hide();
  15. });
  16. var slider = new Ext.Slider({
  17. width: 114,
  18. minValue: 1,
  19. maxValue: 1,
  20. plugins: new Ext.slider.Tip({
  21. getText : function(thumb) {
  22. return String.format('Page <b>{0}</b> of <b>{1}</b>', thumb.value, thumb.slider.maxValue);
  23. }
  24. }),
  25. listeners: {
  26. changecomplete: function(s, v){
  27. pbar.changePage(v);
  28. }
  29. }
  30. });
  31. pbar.insert(idx + 1, slider);
  32. pbar.on({
  33. change: function(pb, data){
  34. slider.setMaxValue(data.pages);
  35. slider.setValue(data.activePage);
  36. }
  37. });
  38. }
  39. });