PDA

View Full Version : BasicDialog and tabs



ines
20 Mar 2007, 6:50 AM
Hello,

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.setDefaultUrl(defaultUrl);
updater.loadScripts = true;
}
// initial state of the buttons
dialogHRDossier.buttons[0].setVisible(false);
dialogHRDossier.buttons[1].disable();
dialogHRDossier.buttons[2].setVisible(false);
//if the properties groups already exists, remove them.
for (var i=dialogHRDossier.getTabs().getCount()-1; i > 0; i--) {
dialogHRDossier.getTabs().removeTab(i);
}
//force the interface to load the dialog on the first tab
dialogHRDossier.getTabs().getTab(0).activate();
var updater = dialogHRDossier.getTabs().getTab(0).getUpdateManager();
updater.refresh();
dialogHRDossier.show(divTag);
},


Thanks for yours answers.
ines.[/code]

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

ines
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.