PDA

View Full Version : [CLOSED] [#617] Tabs with external content are destroyed when window.onbeforeunload is executed



RCN
Dec 18, 2014, 5:23 PM
On the following example (Based on http://examples3.ext.net/#/TabPanel/Basic/Add_Tabs/), the tabs with external content are destroyed even if select "Stay on this page" during window.onbeforeunload

Scenario 1

Initial State

Press F5. You will be prompted about leaving the page
http://forums.ext.net/attachment.php?attachmentid=17421&stc=1

Click on "Stay on this page"

Then we get the following result (Worked as expected):
http://forums.ext.net/attachment.php?attachmentid=17411&stc=1

Now, select the tab "Static - External Content"

Press F5. You will be prompted about leaving the page
http://forums.ext.net/attachment.php?attachmentid=17441&stc=1

Click on "Stay on this page"

"Static - External Content" tab was destroyed
http://forums.ext.net/attachment.php?attachmentid=17451&stc=1




<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<script type="text/javascript">
var DocumentReady = function () {
window.onbeforeunload = DenyExit;
}
var DenyExit = function (e) {
e = e || window.event;

var message = "Ext.Net";

if (e) {
e.returnValue = message;
}

return message;
}
</script>
<ext:XScript runat="server">
<script>
var addTab = function (tabPanel, id, url, menuItem) {
var tab = tabPanel.getComponent(id);

if (!tab) {
tab = tabPanel.add({
id: id,
title: url,
closable: true,
menuItem: menuItem,
loader: {
url: url,
renderer: "frame",
loadMask: {
showMask: true,
msg: "Loading " + url + "..."
}
}
});

tab.on("activate", function (tab) {
App.MenuPanel1.setSelection(tab.menuItem);
});
}

tabPanel.setActiveTab(tab);
}
</script>
</ext:XScript>
</head>
<body>
<ext:ResourceManager runat="server" ScriptMode="Debug">
<Listeners>
<DocumentReady Handler="DocumentReady();" />
</Listeners>
</ext:ResourceManager>
<ext:Window
runat="server"
Title="Adding tab"
Width="800"
Height="500"
Icon="Link"
Layout="BorderLayout">
<Items>
<ext:MenuPanel
ID="MenuPanel1"
runat="server"
Width="200"
Region="West">
<Menu runat="server">
<Items>
<ext:MenuItem runat="server" Text="Ext.NET">
<Listeners>
<Click Handler="addTab(#{TabPanel1}, 'idClt', 'http://www.ext.net', this);" />
</Listeners>
</ext:MenuItem>

<ext:MenuSeparator />

<ext:MenuItem runat="server" Text="Ext.NET forums">
<Listeners>
<Click Handler="addTab(#{TabPanel1}, 'idGgl', 'http://forums.ext.net', this);" />
</Listeners>
</ext:MenuItem>

<ext:MenuSeparator />

<ext:MenuItem runat="server" Text="Sencha">
<Listeners>
<Click Handler="addTab(#{TabPanel1}, 'idExt', 'http://www.sencha.com', this);" />
</Listeners>
</ext:MenuItem>
</Items>
</Menu>
</ext:MenuPanel>
<ext:TabPanel ID="TabPanel1" runat="server" Region="Center">
<Items>
<ext:Panel Title="Static - Html" runat="server">
<Content>
Ext.Net
</Content>
</ext:Panel>
<ext:Panel Title="Static - External Content" runat="server">
<Loader Url="http://www.ext.net" Mode="Frame" runat="server" />
</ext:Panel>
</Items>
</ext:TabPanel>
</Items>
</ext:Window>
</body>
</html>

RCN
Dec 18, 2014, 5:33 PM
Scenario 2

Initial State
17461

Click on both "Ext.Net" and "Ext.Net Forums" buttons

Then we get
17471

Press F5. You will be prompted about leaving the page
17481

Click on "Stay on this page"

"Ext.Net" and "Ext.Net Forums" tabs were destroyed
17491

Note: as shown on Scenario 1, "Static - External Content" would be destroyed if it was loaded prior pressing F5

Thanks in advance


I needed to post the scenarios presented above in two different posts because i was not allowed to upload more than 5 images per post.

Daniil
Dec 21, 2014, 12:57 PM
Hi Raphael,

Thank you for the report. Created an Issue.
https://github.com/extnet/Ext.NET/issues/617

Fixed in the revision 6232 (trunk). It goes to v3.1.0 release.

RCN
Dec 21, 2014, 9:35 PM
Thank you Daniil. I will download the trunk and retest it. I will keep you posted about any issue that i may find.

RCN
Dec 22, 2014, 12:10 PM
Daniil, i tested and everything looks ok. Once again, thank you.

Daniil
Dec 22, 2014, 12:10 PM
Thank you for the confirmation!

RCN
Dec 22, 2014, 12:21 PM
You're welcome