PDA

View Full Version : tab close



KuN
29 Oct 2006, 6:19 AM
if i click 'close' on opened tab then how to determine if tab was closed?
.disabled seems to be true anyway

jack.slocum
29 Oct 2006, 11:37 AM
You can listen for panelremoved on the region to be notified of all tab closes.



var onRemove = function(region, panel){

}
layout.getRegion('center').on('panelremoved', onRemove);

KuN
29 Oct 2006, 12:35 PM
do you have an idea how to make this? :
i have an iframe in the contentpanel and i want to set Tab title and change toolbar contents from the iframe. is it possible? i cant find the way to make that ... (cant use div to make contents of iframe possible to open without framework and view its url :( )

jack.slocum
29 Oct 2006, 2:23 PM
You can access the parent frame (main document) using parent.

KuN
30 Oct 2006, 12:01 AM
i know, but how can i know what panel am i using?
parent will return entire page with panels and i dont know how to get the one i open... i can of course give iframe a name of control panel as a parameter, but its not beutiful...

KuN
30 Oct 2006, 3:06 AM
i add tab id as a query string to iframe, but how can i get it?

i have this:


ST = function(){
....
var tabs;
return {
init : function(){
....
tabs = innerCenter.getRegion('center').tabs;
....
}
}


so iframe does see only ST.tabs = undefined...
the task is to change tab text and toolbar settings..

KuN
30 Oct 2006, 5:59 AM
forget what i wrote above. made it work between frames.

i try to add buttons like that:



initButtons: function(){
if (typeof tb != 'undefined')
{
var toolbar = tb;
toolbar.addButton({id:'button_add', text: 'Add', className: 'button_add', click: this.changeLocation('edit.html',document.mainfrm,'add')});
toolbar.addButton({id:'button_edit', text: 'Edit', className: 'button_edit', click: this.changeLocation('edit.html',document.mainfrm,'edit')});
toolbar.addButton({id:'button_delete', text: 'Delete', className: 'button_delete',click: this.changeLocation('delete.html',document.mainfrm,'delete')});
}
},
changeLocation: function (location, form, action)
{
if (form)
{
var el = getEl('action');
if (typeof el != 'undefined')
{
el.value = action;
form.method = 'POST';
form.action = location + '?' + panel;
form.submit();
}
}
else
{
document.location.href = location + '?' + panel;
}
}


but function is executed on load but not on click. it's a non-documented 'feature'? =\
i can execute smth like this:


click: this.changeLocation.createDelegate(this)


but how to pass parameters there then ?

ps: sorry for so many questions. just working on admin framework and try to understand for framework to implement more included features rather then writing own ones. anyway great work off course.

KuN
30 Oct 2006, 6:20 AM
toolbar.addButton({id:'button_delete', text: 'Delete', className: 'button_delete',click: this.changeLocation.createDelegate({'form': document.mainfrm, 'action': 'delete'})});


changeLocation: function (config)
{
YAHOO.ext.util.Config.apply(this,config);
}


seems to work. am i correctly doing ?

jack.slocum
30 Oct 2006, 12:01 PM
That's some nasty code. If it works that's all that matters.