Add Flex value dynamically to controller in extjs

谁说我不能喝 提交于 2019-12-23 16:34:42

问题


I am giving some items (containers), in "View", a layout of hbox. Now I want to give flex value to each item through the "Controller". How can I do this?

I have gone through the docs but can't find any method like setFlex.

EDIT :

Ext.apply(Ext.getCmp('IdHere'), {flex: 1});

I have got the answer from this link. But now the problem is that even I am changing the flex values dynamically, the view of the containers is not changing. It is remaining same.

I am not assigning flex values initially in "View" as stated here


回答1:


My first guess would be that need to rerun the layout process by calling doLayout() I am not quite sure but I think you have to call in on the parent element which holds the hbox layout.




回答2:


Get your parent container (on which you have applied layout hbox or vbox) then get items and finally change the flex and update the layout

var ct = me.up('#parentComponent');
 ct.items.get('itemId1').flex = 2;
 ct.items.get('itemId2').flex = 2;
 ct.updateLayout();


来源:https://stackoverflow.com/questions/15381200/add-flex-value-dynamically-to-controller-in-extjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!