Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / examples / ux / SlidingPager.js
index 710e718..3e42d0c 100644 (file)
@@ -1,12 +1,13 @@
 /*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
+ * Ext JS Library 3.1.1
+ * Copyright(c) 2006-2010 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
  */
 Ext.ux.SlidingPager = Ext.extend(Object, {\r
     init : function(pbar){\r
-        Ext.each(pbar.items.getRange(2,6), function(c){\r
+        var idx = pbar.items.indexOf(pbar.inputItem);\r
+        Ext.each(pbar.items.getRange(idx - 2, idx + 2), function(c){\r
             c.hide();\r
         });\r
         var slider = new Ext.Slider({\r
@@ -24,14 +25,11 @@ Ext.ux.SlidingPager = Ext.extend(Object, {
                 }\r
             }\r
         });\r
-        pbar.insert(5, slider);\r
+        pbar.insert(idx + 1, slider);\r
         pbar.on({\r
             change: function(pb, data){\r
-                slider.maxValue = data.pages;\r
+                slider.setMaxValue(data.pages);\r
                 slider.setValue(data.activePage);\r
-            },\r
-            beforedestroy: function(){\r
-                slider.destroy();\r
             }\r
         });\r
     }\r