View Full Version : [FIXED-507][3.1] SlidingPager plugin bugs

29 Jan 2010, 5:02 PM
(ExtJs 3.1) I found this plugin very useful, but encountered two issues.

First, when the containing PagingToolbar has other explicit child items and has prependButtons set to true, the following code hides the wrong paging controls and inserts the slider into the wrong position:

Ext.each(pbar.items.getRange(2,6), function(c){
pbar.insert(5, slider);
I worked around it with:

var inputIndex = pbar.items.indexOf(pbar.inputItem);
Ext.each(pbar.items.getRange(inputIndex - 2, inputIndex + 2), function(c) {
pbar.insert(inputIndex + 1, pbar.slider);
Second, when the total page count changes but the current page index remains the same, the slider thumb remains at the wrong position. (This is a pretty common scenario for my app: after refresh the grid, the user needs to stay on the same page, but the total # of rows in the grid store may change.) I worked around it by adding the line in bold:

change: function(pb, data) {
this.slider.maxValue = data.pages;
this.slider.syncThumb(); // force sync slider thumb when maxValue changes but value doesn't change
Could someone review the change above, and fix the issues in the base product? Thanks!

31 Jan 2010, 3:04 PM
I can confirm the first issue, but could you post a test case for the second?

For example, using this sample code:

var s = new Ext.Slider({
width: 200,
renderTo: document.body,
value: 10,
minValue: 0,
maxValue: 20,
animate: false

new Ext.Button({
renderTo: document.body,
text: 'a',
handler: function(){
s.maxValue = 9;

The thumb moves after the setValue() call.

1 Feb 2010, 11:18 PM
Hi Evan,

Thanks for looking into this so quickly. I believe you can reproduce the issue with a slight change to your example:

s.maxValue = 9; to
s.maxValue = 15;It wasn't reproducible with the original example because the value (10) was beyond the maxValue (9), so it was normalized to a different value.

3 Feb 2010, 6:42 PM
A fix was added to SVN.

3 Feb 2010, 7:02 PM