PDA

View Full Version : [CLOSED] ButtonGroup columns



watteeuw
Sep 22, 2012, 6:09 PM
Is possible to change columns number of the ButtonGroup in a resize event ?


Thanks

Daniil
Sep 24, 2012, 8:37 AM
Hi,

ButtonGroup internally uses the TableLayout. It doesn't support changing the number of columns on the fly. Rerendering the ButtonGroup can be a solution.

Or, maybe, you would prefer to switch to a Container with respective layout instead of ButtonGroup.

watteeuw
Sep 24, 2012, 10:30 AM
Tried to Render the Group but no success. I saw a meesage on ExtJs forum saying is not possible.

Switched to container and tried this, but didn't find the wining combination, yet:

<Viewport>
<Listeners>
<Resize Handler="var size = Ext.getBody().getViewSize(); if(size.width>1100) {#{Container3}.layout.type='hbox';} else {#{Container3}.layout.type='vbox';} #{Container3}.doComponentLayout(); " />





Hi,

ButtonGroup internally uses the TableLayout. It doesn't support changing the number of columns on the fly. Rerendering the ButtonGroup can be a solution.

Or, maybe, you would prefer to switch to a Container with respective layout instead of ButtonGroup.

Daniil
Sep 24, 2012, 10:51 AM
Tried to Render the Group but no success.

Please demonstrate how did you try?


I saw a meesage on ExtJs forum saying is not possible.

Please clarify what exactly is not possible? Re-rendering the ButtonGroup?



Switched to container and tried this, but didn't find the wining combination, yet:

<Viewport>
<Listeners>
<Resize Handler="var size = Ext.getBody().getViewSize(); if(size.width>1100) {#{Container3}.layout.type='hbox';} else {#{Container3}.layout.type='vbox';} #{Container3}.doComponentLayout(); " />


I think changing ct.layout.type is not enough to change a layout. Generally, I am not sure the containers support changing its layout on the fly. There is the setLayout method.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.container.AbstractContainer-method-setLayout

But it is private. There is no guarantee that it will work will in public usage. I think changing the layout requires re-rendering as well.

Could you, please, clarify what exactly are you trying to achieve? Mockups with the initial and after resizing states would be appreciated. Then, probably, we could suggest something concrete.