PDA

View Full Version : Find the flex width



samseena
20 Nov 2012, 11:07 PM
I am having a page where I have a navigation on the left hand side and an image gallery that displays images in a grid format. The Image grid has a flex equal to 7.

I need to find the flex width or the width of the page on the right hand side. SO that I need to fill this entire width with the images.

Please help me in finding the width of the flex. (eg. if flex = 7, what is the flexwidth/width?)

Appreciate your reply.

mitchellsimoens
23 Nov 2012, 7:20 AM
If on item has flex : 7 then it's width is dependent on the value of flex and width of the other items.

samseena
29 Nov 2012, 12:35 AM
The problem what I am facing exactly is that I need to find the width of the data view item on the right.
i.e I have a navigation bar on the left and the grid view on the right.
I give an id: 'ImGrid' for the data view item (Ext.dataview.Dataview). On page load, I am not able to fetch the width using 'Ext.get('ImGrid').getWidth();

Please let me know if there are any other ways to find the page width in this case :(

Thanks in advance.

samseena
29 Nov 2012, 8:55 PM
I solved this issue :)

on the "beforeInitialize" function I used the "painted" event and I was able to get the width.

beforeInitialize: function(config) {
this.on('painted', 'onImgPainted', this);
},
onImgPainted: function () {
var screen_width = Ext.get('ImGrid').getWidth();
this.handleOrientationImgGrid(screen_width);
},