/*!
- * Ext JS Library 3.1.0
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
+ * Ext JS Library 3.3.1
+ * Copyright(c) 2006-2010 Sencha Inc.
+ * licensing@sencha.com
+ * http://www.sencha.com/license
*/
-Ext.ux.SlidingPager = Ext.extend(Object, {\r
- init : function(pbar){\r
- Ext.each(pbar.items.getRange(2,6), function(c){\r
- c.hide();\r
- });\r
- var slider = new Ext.Slider({\r
- width: 114,\r
- minValue: 1,\r
- maxValue: 1,\r
- plugins: new Ext.ux.SliderTip({\r
- getText : function(s){\r
- return String.format('Page <b>{0}</b> of <b>{1}</b>', s.value, s.maxValue);\r
- }\r
- }),\r
- listeners: {\r
- changecomplete: function(s, v){\r
- pbar.changePage(v);\r
- }\r
- }\r
- });\r
- pbar.insert(5, slider);\r
- pbar.on({\r
- change: function(pb, data){\r
- slider.maxValue = data.pages;\r
- slider.setValue(data.activePage);\r
- },\r
- beforedestroy: function(){\r
- slider.destroy();\r
- }\r
- });\r
- }\r
+/**
+ * Plugin for PagingToolbar which replaces the textfield input with a slider
+ */
+Ext.ux.SlidingPager = Ext.extend(Object, {
+ init : function(pbar){
+ var idx = pbar.items.indexOf(pbar.inputItem);
+ Ext.each(pbar.items.getRange(idx - 2, idx + 2), function(c){
+ c.hide();
+ });
+ var slider = new Ext.Slider({
+ width: 114,
+ minValue: 1,
+ maxValue: 1,
+ plugins: new Ext.slider.Tip({
+ getText : function(thumb) {
+ return String.format('Page <b>{0}</b> of <b>{1}</b>', thumb.value, thumb.slider.maxValue);
+ }
+ }),
+ listeners: {
+ changecomplete: function(s, v){
+ pbar.changePage(v);
+ }
+ }
+ });
+ pbar.insert(idx + 1, slider);
+ pbar.on({
+ change: function(pb, data){
+ slider.setMaxValue(data.pages);
+ slider.setValue(data.activePage);
+ }
+ });
+ }
});
\ No newline at end of file