PDA

View Full Version : setActiveItem(0) does not work



rakagod
25 Nov 2011, 11:39 AM
In version 4.0.7, the following code worked

this.getDispatchCards().getLayout().setActiveItem(0);
but in version 4.1 that line no longer works.
The other 2 lines that reference "setActiveItem(1) and setActiveItem(2) still work.
Also the default that set "activeItem: 0", no longer works.


},
btnRequestPressed: function() {
//alert('You clicked the ReceiveCall button!');
this.getDispatchCards().getLayout().setActiveItem(0);
this.getBtnRequest().disabled = true;
this.getBtnDispatch().disabled = false;
this.getBtnAdministration().disabled = false;
},
btnDispatchPressed: function() {
//alert('You clicked the Dispatch button!');
this.getDispatchCards().getLayout().setActiveItem(1);
this.getBtnRequest().disabled = false;
this.getBtnDispatch().disabled = true;
this.getBtnAdministration().disabled = false;
},
btnAdministrationPressed: function() {
//alert('You clicked the Administration button!');
this.getDispatchCards().getLayout().setActiveItem(2);
this.getBtnRequest().disabled = false;
this.getBtnDispatch().disabled = false;
this.getBtnAdministration().disabled = true;
}

The layout is as follows:


Ext.define('Calls.view.ui.MViewport', {
extend: 'Ext.container.Viewport',
requires: [
'Calls.view.MainToolbar',
'Calls.view.RequestForm',
'Calls.view.DispatchForm'
],


activeItem: 0,


initComponent: function() {
var me = this;


Ext.applyIf(me, {
items: [
{
xtype: 'panel',
itemId: 'dispatchPanels',
layout: {
type: 'fit'
}
},
{
xtype: 'mainToolbar'
},
{
xtype: 'panel',
itemId: 'dispatchCards',
activeItem: 0,
layout: {
type: 'card'
},
title: '',
items: [
{
xtype: 'panel',
itemId: 'requestFormSplit',
layout: {
align: 'stretchmax',
type: 'hbox'
},
items: [
{
xtype: 'requestForm',
flex: 1
},
{
xtype: 'panel',
itemId: 'requestFormSpacePanel',
flex: 1
}
]
},
{
xtype: 'dispatchForm'
},
{
xtype: 'panel',
itemId: 'administrationForm',
title: 'Administration',
items: [
{
xtype: 'label',
text: 'Administration form'
}
]
}
]
}
]
});


me.callParent(arguments);
}
});

mitchellsimoens
27 Nov 2011, 6:14 AM
This is working for me in 4.1 PR1:


Ext.create('Ext.container.Viewport', {
layout : 'fit',

items : [
{
xtype : 'panel',
layout : 'card',
items : [
{
title : 'One',
html : 'One'
},
{
title : 'Two',
html : 'Two'
}
],
dockedItems : [
{
xtype : 'toolbar',
dock : 'top',
items : [
{
text : 'Back',
disabled : true,
action : 'back',
handler : function(btn) {
var panel = btn.up('panel'),
toolbar = btn.up('toolbar'),
forward = toolbar.down('button[action=forward]');

panel.getLayout().setActiveItem(0);

forward.enable();
btn.disable();
}
},
'->',
{
text : 'Forward',
action : 'forward',
handler : function(btn) {
var panel = btn.up('panel'),
toolbar = btn.up('toolbar'),
back = toolbar.down('button[action=back]');

panel.getLayout().setActiveItem(1);

back.enable();
btn.disable();
}
}
]
}
]
}
]
});

rakagod
27 Nov 2011, 8:53 AM
This is working for me in 4.1 PR1:

I designed the layout with Ext.Designer 1.2.2.
It works under 4.0.7 but not under 4.1 PR1 (without changes).
I am reporting a bug with my code and your response is to tell me that your code works.

Congratulations, your code works. Unfortunately mine does not.
Again, it works under 4.0.7 but not under 4.1 PR1.

mitchellsimoens
27 Nov 2011, 9:27 AM
I designed the layout with Ext.Designer 1.2.2.
It works under 4.0.7 but not under 4.1 PR1 (without changes).
I am reporting a bug with my code and your response is to tell me that your code works.

Congratulations, your code works. Unfortunately mine does not.
Again, it works under 4.0.7 but not under 4.1 PR1.

Really? Ok... Sorry your code isn't working, provided above is working for me so break your code down to figure out what is causing it to not work.

You said "but in version 4.1 that line no longer works."... kind of hard to know why it doesn't work by that statement.

Mainly... what component does getDispatchCards() get you because in my code I provided the rest is the same.

Enjoy

rakagod
27 Nov 2011, 12:38 PM
Really? .. so break your code down to figure out what is causing it to not work.

You said "but in version 4.1 that line no longer works."... kind of hard to know why it doesn't work by that statement.

Mainly... what component does getDispatchCards() get you because in my code I provided the rest is the same.

Enjoy

I did break down the code, that line is where it stops working.
I am including the full app which is tiny because I was just starting it.
It is in a version 4 MVC architecture which so far, with other test apps, has proven to be a major pain.
There is no data and no store, just code.
Run it with 4.0.7 and see the 3 buttons work and display panels.
Run it with 4.1 and see the first button not work and a different display with button 2.
I created the layouts with the trial version of Ext.Designer 1.2.2.

Now you have everything I have.
Enjoy