PDA

View Full Version : Center slider object



yo_haha
16 Oct 2012, 5:14 AM
Hi,
I added a slider object to a <div style="text-align: center"></div> element. I put margins: 'auto' in the constructor of the slider in order to render it centered in the div.
It seems that the margins attribute is ignored because the slider isn't centered and Firbug says that margin is 0.
Is there a way to center the slider?
The div element is a child I've created for the TreeNode.getUI().getAnchor().

Also, when I click on the slider, the page reloads. Is there a way to deactivate that behaviour?

Regards.

mitchellsimoens
22 Oct 2012, 8:48 AM
The margin needs an int or a string of numbers, 'auto' is not supported as the margin config is used for layouts.


Ext.create('Ext.slider.Single', {
width : 200,
value : 50,
increment : 10,
minValue : 0,
maxValue : 100,
margin : 10,
renderTo : Ext.getBody()
});

yo_haha
22 Oct 2012, 10:30 AM
Ok thanks.
Now I have another problem.
getAnchor() returns undefined. I don't know what I've changed in the code that affected this methos.
getUI() works and return the UI as expected.