PDA

View Full Version : [CLOSED] Ext.NET Window Override



softmachine2011
Jul 20, 2012, 9:59 AM
Hi,

When I create a dynamic window with closeAction='destroy' or call to method destroy() of a window in ext.net v2.x it throws me a null reference exception in js side.

I saw that there is this function that makes an override of extjs base functionallity



// @source core/container/Container.js
Ext.Container.override({
...
onIFrameRelayedEvent: function (event) {
var iframeEl = this.iframe, //Here for some reason iframe doesn't exists. this.iframe=undefined
iframeXY = iframeEl.getXY(),
eventXY = event.getXY();

event.xy = [iframeXY[0] + eventXY[0], iframeXY[1] + eventXY[1]];

event.injectEvent(iframeEl);

event.xy = eventXY;
}
...
});


This is how I open the windows:



var w = Ext.create("Ext.window.Window", {
closeAction: "destroy",
renderTo: Ext.getBody(),
title: 'window title',
itemID: 'sampleID',
itemDetailChanged: false,
modal: false,
resizable: true,
maximizable: false,
minimizable: false,
collapsible: false,
draggable: true,
isMinimized: false,
isMaximized: false,
minimizePosition: -1,
originalWidth: 500,
originalHeight: 500,
restoreTop: undefined,
restoreLeft: undefined,
minWidth: 500,
minHeight: 500,
width: 500,
height: 500,
isModal: false,
constrain: true,
items: [{
xtype: "netlabel",
text: "Sample"
}],
directEvents: {
hide: {
fn: function (el) {
debugger;
},
delay: 20
}
}
});

if (!Ext.isEmpty(w.parentTab))
w.parentTab.anyDetailOpened = true;

w.on("beforehide", function () {
if (w.mandatoryClose == true)
return true;

var allowClose = true;

try {
if (!Ext.isEmpty(w.onClose))
allowClose = w.onClose(w, MyApp.Windows.applyClose);

} catch (ex) {
//No se puede ejecutar una funcion de una ventana ya cerrada
}

return (allowClose);
});

if (w.isModal) {
w.tools["minimize"].hide();
w.tools["maximize"].hide();
}

w.show();


But in a sample project doesn't crash me.
How can I reproduce it for you to have a test example? When is iframe property deleted?

Daniil
Jul 20, 2012, 12:04 PM
Hi,

We will try to reproduce.

Just a note.

Please don't define "directEvents" client side. It should be only generated with server DirectEvents.

Please use listeners + DirectMethods.

Daniil
Jul 20, 2012, 1:25 PM
Please update from SVN and re-test.

softmachine2011
Jul 23, 2012, 8:29 AM
Hi,

With revision 4213 I got this error when I launch the application.

4524

I reverted to 4211, and tested my case. With it seems to work right!

I would use rev. 4211 while this error is fixed.

Thanks!

Vladimir
Jul 23, 2012, 10:19 AM
I found that it is .NET bug
https://connect.microsoft.com/VisualStudio/feedback/details/588847
http://connect.microsoft.com/VisualStudio/feedback/details/541962/unable-to-load-one-or-more-of-the-requested-types-connected-with-entitydatasource

We will wrap that code by try/catch block. Do you use MVC apllication?

softmachine2011
Jul 23, 2012, 11:28 AM
Yes I use an MVC Application.

With rev 4214 works right again.

Thanks Vlad!