PDA

View Full Version : Problem adding items in a panel after creating it



samax
26 Jun 2009, 7:21 AM
Hello,
I have a tabpanel, and in each tab I've a panel which contains most things. I need to pass variables to these things when I display them (on tab content displaying, so when I click on the tab).

The problem is that I need to pass these variables at the initialization of these things, so I want to add them to the Panels containing them at the showing (of the panels). When I try to do this, I get an error from extjs: "items is undefined".
Here is what I do:


var enquetesFormPanel = new Ext.form.FormPanel({
height: 450,
region: 'center',
principalForeignKey: {name: 'indexbatiment', value: this.batimentId}
});

var enquetesTab = new Ext.Panel ({
title: 'Enquêtes',
closable: true,
layout: 'fit',
autoShow: true
});

enquetesTab.on('beforeshow', function () {
this.items = [
enquetesFormPanel
];
});


When I remove the "this.items = [...]" in the beforeshow of enquetesTab, I've no error (but of course I've no content in it). That is what's leads me to say that the error don't appears because I don't set items at the initializing of enquetesPanel, but because I put items on it after initializing.

Does someone has an idea of how to resolve this issue?

Thanks.

samax
28 Jun 2009, 11:21 PM
Please, I've not succeeded to fix it since last friday, can you help me??

Animal
28 Jun 2009, 11:27 PM
Adding.

add

API docs?

samax
28 Jun 2009, 11:36 PM
Okey... I don't know how I did that, but I missed something that was right under my nose! Thank you, due to seeking I did not manage to concentrate me anymore ...