-
24 Jan 2012 12:04 AM #1
Unanswered: Applying flex after component creation
Unanswered: Applying flex after component creation
Hello
When I try to apply flex to a component that's already been initialized, it does not affect (looking through the source I see that it doesn't have any listeners on it and the flex is only applied during creation.
A side affect of that is that I wrap the component with a dummy container and give that container flex (because I control it's creation time)
Is it a bug or a feature?
Thanks!
-
24 Jan 2012 10:49 AM #2
There is no way to do this at the component/item level. You need to access the containers layout and set it using that. You can do this using the following code:
Where container is your container, item is the item you want to change the flex on, and 3 is the new flex you want to set.Code:container.getLayout().setItemFlex(item, 3);
There are no docs for this in PR4 unfortunately, but there will be in the next release.
Sencha Inc.
Robert Dougan - @rdougan
Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.
-
1 Jun 2012 4:58 AM #3
When I try this:
PHP Code:Ext.define('Delen0001.view.Dashboard', {
extend: 'Ext.Container',
xtype: 'dashboard',
config:{
fullscreen: true,
layout: {
type: 'vbox',
pack: 'center'
},
id: 'testje',
items:[
{
xtype: 'panel',
id: 'blockone',
items:[
{
xtype: 'toolbar',
title: "Delen Today",
},
],
flex: 1,
listeners: {
tap: function() {
Delen0001.view.Dashboard.getLayout().setItemFlex('blockone',0);
},
element: 'element'
...
I get this error:
Uncaught TypeError: Object function () { return this.constructor.apply(this, arguments); } has no method 'getLayout'
Can anyone perhaps provide the correct syntax for this line:
ThanksPHP Code:Delen0001.view.Dashboard.getLayout().setItemFlex('blockone',0);


Reply With Quote