Sep 25, 2015, 11:10 AM
[CLOSED] Open window not working from included js-file
Hi,
We have a problem with opening a window. If we have the JavaScript functions in the aspx-file they work great, but when we have them in a separate JavaScript-file and include the file on the page it does not work. Why is this?
Best regards,
Bella
JSGlobal.js
We have a problem with opening a window. If we have the JavaScript functions in the aspx-file they work great, but when we have them in a separate JavaScript-file and include the file on the page it does not work. Why is this?
Best regards,
Bella
JSGlobal.js
function openNewWindow(title, url, id, modal, width, height, renderToLevel) {
try {
if (width == 0)
width = 760;
if (height == 0)
height = 500
newWindow({ title: title, height: height, width: width, minHeight: height, minWidth: width, modal: modal, maximizable: true }, url, '', id, renderToLevel);
}
catch (e) {
Ext.Msg.alert('Error', e.message);
}
}
var newWindow = function (config, url, html, id, renderToLevel) {
var renderToObject;
var window;
if (parent.parent.parent != null && renderToLevel == 3) {
renderToObject = parent.parent.parent;
}
else if (parent.parent.Ext.getBody() != null && renderToLevel == 2) {
renderToObject = parent.parent;
}
else if (parent.Ext.getBody() != null && renderToLevel == 1) {
renderToObject = parent;
}
else {
renderToObject = this;
}
body = renderToObject.Ext.getBody();
window = renderToObject.Ext.getCmp(id);
if (window != null)
window.close();
if (url != '') {
new renderToObject.Ext.Window(renderToObject.Ext.apply({
renderTo: renderToObject.Ext.getBody(),
resizable: true,
height: 500,
width: 500,
frame: true,
padding: 5,
id: id,
collapsible: true,
loader: { maskMsg: 'Loading...', showMask: true, renderer: 'frame', url: url }
}, config)).show();
}
else if (html != '') {
new renderToObject.Ext.Window(renderToObject.Ext.apply({
renderTo: renderToObject.Ext.getBody(),
resizable: true,
height: 500,
width: 500,
frame: true,
padding: 5,
id: id,
collapsible: true,
html: html
}, config)).show();
}
}
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script type="text/javascript" src="JSGlobal.js"> </script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Combo Boxes - Ext.NET Examples</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager ID="resourceManager" runat="server">
</ext:ResourceManager>
<ext:Viewport ID="vp" runat="server">
<Items>
<ext:Button runat="server" Text="Click">
<Listeners>
<Click Handler="openNewWindow('Test', 'Test1.aspx', 'wndBookingSelection', false, 1035, 400, 0);"></Click>
</Listeners>
</ext:Button>
</Items>
</ext:Viewport>
</form>
</body>
</html>
Last edited by Daniil; Sep 28, 2015 at 10:44 AM.
Reason: [CLOSED]