PDA

View Full Version : Slider doesn't move if parent component has property hidden: true



gido
23 Aug 2011, 4:45 AM
Sencha Touch version tested:

1.1.0 ____

only default ext-all.css


Platform tested against:

iOS 4


Description:

Imagine you have a slider (with an initial value set) in a fieldset which is by default hidden. When you show the fieldset (fieldset.show()) the slider doesn't move to it initial value position.


Test Case:



Ext.regApplication({
name: "test",
launch: function() {
var testPanel = new Ext.Panel({
fullscreen: true,
items: [
{
xtype: 'button',
text: 'Show',
handler: function(btn) {
Ext.getCmp('fieldsetTest').show()
}
},
{
xtype: 'button',
text: 'Show with a Hack',
handler: function(btn) {
var slider = Ext.getCmp('sliderTest'),
thumb = slider.getThumb(),
fieldset = Ext.getCmp('fieldsetTest');

fieldset.show();

// force to recalculate thumb boundary
thumb.dragObj.updateBoundary();
slider.setValue(slider.value);
}
},
{
xtype: 'fieldset',
title: 'Fieldset slider',
id: 'fieldsetTest',
hidden: true,
items: [{
xtype: 'sliderfield',
id: 'sliderTest',
name : 'test',
label: 'Slider test',
value : 50,
minValue: 1,
maxValue: 100,
increment : 1,
}]
}
]
});
}
});



Steps to reproduce the problem:

Click on the "Show" button


The result that was expected:

The slider is showed and moved to the middle position


The result that occurs instead:

The slider is showed but the slider doesn't move the middle position.


Screenshot or Video:

none


Debugging already done:

I spend some time to find where is the problem and try to find a solution.
The problem is in the Ext.form.Slider.getPixelValue() method (which in my case always return 0)


Possible fix:

Try the "Show with a Hack" button...

gido
23 Aug 2011, 4:49 AM
Perhaps related to this thread http://www.sencha.com/forum/showthread.php?110635-FIXED-343-Slider-doesn-t-move-if-hidden&highlight=slider+hidden