View Full Version : BasicDialog and tabs

20 Mar 2007, 6:50 AM

I have a problem with the tabs inside a Dialog.
I created a Basic Dialog in order to do a wizard. The first tab of the dialog is static.
When the user clicks on the next button, many tabs are created and the first is activate.
If he clicks on the cancel button, the dialog is hidden.
And then, he clicks to open the dialog: I remove all the generated tabs in order to keep the first static tab and i refresh its content.
Problem: in the tabPanel of the dialog, i see that the active tab is the tab where the user has clicked on the cancel button. But this tab doesn't exist in the TabPanel, and so when the dialog is open my first static page is not refresh event if i put myDialog.getTabs().getTab(0).activate().

Dialog creation:

loadHRDossierDialog : function loadHRDossierDialog(divTag){
var defaultUrl = 'hrdossierCreation.jsp';
if (!dialogHRDossier) {
dialogHRDossier = new YAHOO.ext.BasicDialog("HRDossierDialog", {
autoCreate: false,
width: 800,
height: 600,
resizable: true,
minHeight: 400,
minWidth: 300,
modal: true,
autoScroll: true,
closable: true,
constraintoviewport: true,
draggable: true,
autoTabs: true,
fixedcenter: false,
shadow: false,
minButtonWidth: 75,
// add buttons.
dialogHRDossier.addKeyListener(27, dialogHRDossier.hide, dialogHRDossier);
dialogHRDossier.addButton('OK', dialogHRDossier.hide, dialogHRDossier);
dialogHRDossier.addButton('Next', dialogHRDossier.hide, dialogHRDossier);
dialogHRDossier.addButton('Previous', dialogHRDossier.hide, dialogHRDossier);
dialogHRDossier.addButton('Cancel', dialogHRDossier.hide, dialogHRDossier);

var updater = dialogHRDossier.getTabs().getActiveTab().getUpdateManager();
updater.loadScripts = true;
// initial state of the buttons
//if the properties groups already exists, remove them.
for (var i=dialogHRDossier.getTabs().getCount()-1; i > 0; i--) {
//force the interface to load the dialog on the first tab
var updater = dialogHRDossier.getTabs().getTab(0).getUpdateManager();

Thanks for yours answers.

20 Mar 2007, 10:54 PM
After clearing the tabs, call tabs.activate(0)

21 Mar 2007, 1:49 AM
I have the same problem: i have changed dialog.getTabs().getTab(0).activate() by dialog.getTabs().activate(0).
I open my wizard, the static tab-0 is loaded. Then, i click on the next button and the tab-1, tab-2, ..., tab-5 are loaded. The tab-1 is activate.
I close the wizard by clicking on the cancel button.
And if i open the wizard again, all the generated tabs are removed. And normally the tab-0 should be loaded.
And when i watch the expression 'dialog.getTabs()' in my debugger, i see that the active tab is still the tab-1... whereas there is no longer the tab-1 in the tabpanel items. There is just the tab-0.