i'm having trouble while closing a RadWindow.
I can't post the entire project because of the dimensions but i'm posting as much code as possibile of what i think could be relevant.
In my project there's a JS function used to get the rad window and you'll see it used in TS scripts as window.GetRadWindow():
function GetRadWindow() { var oWindow = null; if (window.radWindow) oWindow = window.radWindow; else if (window.frameElement) if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; return oWindow;}I have a base page that opens a RadWindow (here called WINDOW1) with this code, and with this close event attached:
private btnAddFarmacoClick(): void { window.DeskDataEditing(true); var url = `${this.schedaRicFarmaGestFarmacoUrl}?IdItem=-1&IdFarmaco=-1`; let oBrowserWnd = window.GetRadWindow(); setTimeout(() => { let oWnd: t.RadWindow = oBrowserWnd ? oBrowserWnd.BrowserWindow.radopen(url, "wSchedaRicGestFarm") : window.radopen(url, "wSchedaRicGestFarm"); oWnd.moveTo(10, 10); oWnd.set_height(400); oWnd.set_width(700); oWnd.set_modal(true); oWnd.set_title("Titolo"); oWnd.set_visibleTitlebar(true); oWnd.set_visibleStatusbar(false); oWnd.set_behaviors(t.WindowBehaviors.Move | t.WindowBehaviors.Close); oWnd.remove_close(this.farmacoRiconciliazioneClose$dlg); oWnd.add_close(this.farmacoRiconciliazioneClose$dlg); //oWnd.set_destroyOnClose(true); }, 0); } private farmacoRiconciliazioneClose(oWnd: any, args: any): void { oWnd.remove_close(this.farmacoRiconciliazioneClose$dlg); var arg = args.get_argument(); if (arg != null) {//DO THINGS } }Then, in WINDOW1, i open another rad window (WINDOW2) with this script and event attached:
private ricercaFarmacoClick(): void { let url = `${this.ricercaFarmaciUrl}?Close1Step=1&idTest=-1`; let oBrowserWnd = window.GetRadWindow(); setTimeout(() => { let oWnd: t.RadWindow = oBrowserWnd ? oBrowserWnd.BrowserWindow.radopen(url, "wSchedaRicFarmRicercaFarmaco") : window.radopen(url, "wSchedaRicFarmRicercaFarmaco"); oWnd.moveTo(10, 10); oWnd.set_height(570); oWnd.set_width(800); oWnd.set_modal(true); oWnd.set_visibleStatusbar(false); oWnd.set_behaviors(t.WindowBehaviors.Move | t.WindowBehaviors.Close); oWnd.remove_close(this.ricercaFarmacoClose$dlg); oWnd.add_close(this.ricercaFarmacoClose$dlg); //oWnd.set_destroyOnClose(true); }, 0);}private ricercaFarmacoClose(oWnd, args): void { oWnd.remove_close(this.ricercaFarmacoClose$dlg); let arg = args.get_argument(); if (arg != null) { //DO THINGS }}In WINDOW2 i open a third rad window (WINDOW3) with no event attached:
private dettaglioFarmacoClick(sender: any) { if (sender && sender.currentTarget) { let idFarmaco = sender.currentTarget.getAttribute("data-id-farm"); let url = `${this.dettaglioFarmacoUrl}?IdFarmaco=${idFarmaco}`; let oBrowserWnd = window.GetRadWindow(); setTimeout(() => { let oWnd = oBrowserWnd ? oBrowserWnd.BrowserWindow.radopen(url, "wRicercaFarmaciDettaglioFarmaco") : window.radopen(url, "wRicercaFarmaciDettaglioFarmaco"); oWnd.moveTo(10, 10); oWnd.set_height(600); oWnd.set_width(800); oWnd.set_modal(true); oWnd.set_visibleStatusbar(false); oWnd.set_behaviors(t.WindowBehaviors.Move | t.WindowBehaviors.Close); oWnd.set_destroyOnClose(true); }, 0); }}WINDOW3 has nothing special: some readonly data, and can be closed by the X of the rad window itself and from a button that does this:
function CloseModal() { setTimeout(function () { GetRadWindow().close(); }, 0);}
The problem occurs whem i close WINDOW3:
i expect nothing to happen, instead the ricercaFarmacoClose of WINDOW1 is called. Obviously this beahviour causes all the chain of events to break.
I tried adding and removing all the destroyonclose without success. It's been 4 days of debugging, trying and failing at solving this problem.
Is there something i am missing?
Tanks in advance
