PDA

View Full Version : Basic Dialog - Changing the parent (anchor)-element?



tobiu
1 Jun 2007, 2:42 AM
hello together,

i am developing a blog-system using the basic dialog for writing new topics or answers.
when i have, for example, 5 topics on a page, i have 5 buttons to display the basic dialog.

with the show() function, it is no problem to open the dialog-window from each button.
it also is no problem to change the content, for example by changing the src of the iframe i use in the tab-view.

what i would like to know is: is there a possibility to change the parent (anchor) element, from which the animation that creates the basic dialog starts?

thanks, tobiu

EDIT: fixed headline to parent, because there exists an anchorTo - Function, which changes the position of the dialog

BernardChhun
1 Jun 2007, 2:47 AM
add the starting DOM point in the show function as below :)


yourDialog.show("dom-element-id");

tobiu
1 Jun 2007, 3:01 AM
thanks for the tipp, i will try it right now.

i also found a working solution:



var EditorBlogClass = function(){

var dialogEditorBlog, showVisualizeElement, myElement;
myElement = "onClickEditorBlog";

return {
init : function(){
showVisualizeElement = Ext.get(myElement);
},

setNewAnchor : function(){
myElement = Ext.get('newanchor');
EditorBlogClass.init();
},

showVisualizeElement : function(){
if(!dialogEditorBlog){
dialogEditorBlog = new Ext.BasicDialog("EditorBlog-dlg", {
autoScroll: false,
modal:true,
autoTabs:true,
width:596,
height:420,
shadow:true,
minWidth:250,
minHeight:250,
shim: false,
proxyDrag: true,
resizable: true
});
dialogEditorBlog.addKeyListener(27, dialogEditorBlog.hide, dialogEditorBlog);
dialogEditorBlog.addButton('Save', EditorBlogClass.save, EditorBlogClass);
dialogEditorBlog.addButton('Close', dialogEditorBlog.hide, dialogEditorBlog);
dialogEditorBlog.on("resize",function(){}
);
}
dialogEditorBlog.show(showVisualizeElement.dom);
},

save : function(){
dialogEditorBlog.hide();
}
};
}();

tobiu
1 Jun 2007, 3:11 AM
hi bernard,

i tried your solution now.
with adding a variable to the show-function, i get the basic dialog displayed right in time, with no more animation, so i can not see, if it works (only tested in firefox).

so i guess i need to keep the 2nd init.