Reputation: 41
I need to get the width of the the div class named 'msg' based on the div id 'task123' and also change the width accordingly using Ext.query
method function in extjs
html code <div id="task123"> <div class="msg" id="sample"> <ul class="msg-icons">Item 1</ul> <h3>"welcome"</h3> <div>Element</div> </div> </div> the ext js code follows:
get the width of the div.msg based on the div id task123. Ext js:
var el = Ext.fly(task123).query('div.msg',true); var wh = (2 * (el[0].getWidth())); el.setWidth(wh);
it displays no property getWidth for the element. I think the problem on getting the index element.
Upvotes: 0
Views: 875
Reputation: 643
please try this its working for me :
var el = Ext.get('sample');
var wh = (2 *(el.getWidth()));
el.setWidth(wh);
Upvotes: 2
Reputation: 30082
If you're trying to get a single child:
var el = Ext.fly('task123').down('div.msg');
el.setWidth(el.getWidth() * 2);
Upvotes: 0