Nov 16, 2013, 11:08 PM
User control and desktop windows
In a desktop application, I have to open many windows with some times the same content.
For example, I need to open two document properties window on same time for two different documents.
To deal with this, I investigated to use a UserControl.
I set up a specific ID for each UC (UC1 and UC2 for example).
I arrive to display my 2 desktop windows with the same UC (UC1 and UC2).
My questions are :
1 - Even setting up CloseAction to Destroy, I have some ghost div corresponding to the window just destroyed in the dom of the page
So even destroying the window, I can't use the same UC Id (some js errors occurs)
2 - How to deal with direct method :
Must I call them with a prefix like this :
How to know the name of the directmethod :
For example, I'm in the UC1 and I have a button UC1_Button1 with a click Handler="getInfo()";
getInfo is a js method that calls a directMethod : how to know the name of the directmethod :
- App.direct.UC1.GetInfo() or
- App.direct.UC2.GetInfo()
Maybe I have to pass the ID of the UC to the getInfo method ?
Maybe an other solution is to use DirectMethod with WebService like this :
But I have to deal with local variables (specific of each window context) as it explains in the previous success method.
The previous jsonservice is as quickly as a static directmethod ?
What can you advise me ?
Thank you.
For example, I need to open two document properties window on same time for two different documents.
To deal with this, I investigated to use a UserControl.
I set up a specific ID for each UC (UC1 and UC2 for example).
I arrive to display my 2 desktop windows with the same UC (UC1 and UC2).
My questions are :
1 - Even setting up CloseAction to Destroy, I have some ghost div corresponding to the window just destroyed in the dom of the page
So even destroying the window, I can't use the same UC Id (some js errors occurs)
2 - How to deal with direct method :
Must I call them with a prefix like this :
App.direct.AnyUniqueID.MyMethod() //in my case, the uniqueId are UC1, UC2, ...
How to know the name of the directmethod :
For example, I'm in the UC1 and I have a button UC1_Button1 with a click Handler="getInfo()";
getInfo is a js method that calls a directMethod : how to know the name of the directmethod :
- App.direct.UC1.GetInfo() or
- App.direct.UC2.GetInfo()
Maybe I have to pass the ID of the UC to the getInfo method ?
Maybe an other solution is to use DirectMethod with WebService like this :
var jsonService = function (name, UCId) {
Ext.net.DirectMethod.request({
url : "JsonService.asmx/SayHello",
cleanRequest : true,
json : true,
params : {
name : name
},
success : function (result) {
// Setting the local variable
Eval('myLocalVar' + UCId) = result;
Ext.Msg.alert("Json Message", result);
}
});
In this case, i use only one DirectMethod for all the windows opened.But I have to deal with local variables (specific of each window context) as it explains in the previous success method.
The previous jsonservice is as quickly as a static directmethod ?
What can you advise me ?
Thank you.