PDA

View Full Version : How to find message box from inside



Ex_Soft
13 Jul 2012, 5:23 AM
Ext.onReady(function() {
Ext.create("Ext.toolbar.Toolbar", {
items: [{
text: "MessageBox",
handler: function(btn, e) {
Ext.MessageBox.show({
title: "Title",
msg: "Message with <a href=\"#\" onclick=\"DoIt(this, &quot;Test&quot;);\">link</a>",
buttons: Ext.Msg.YESNOCANCEL,
icon: Ext.Msg.QUESTION
});
}
}],
renderTo: Ext.getBody()
});
});

function DoIt(a) {
var
e,
mb;

if((e=Ext.fly(a))
&& (mb=e.up("messagebox"))) // mb is null
mb.hide();
}

sword-it
13 Jul 2012, 7:15 AM
Hi,
Try the code give below:



function DoIt(a) {
var e,mb;
if ((e = Ext.fly(a))
&& (mb = e.dom)) // mb is null
var window = Ext.get(Ext.get(e.dom).findParent('div.x-window'));
window.hide();
}

Ex_Soft
13 Jul 2012, 10:22 AM
'div.x-window'
THNX


function DoIt(a) {
Ext.fly(a).up("div.x-window").hide();
}

works fine