iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hello,
What's the best way to access the WebDesktopManager to call a javascript create window function. To date, I have been including a JavaScript function on the page that has the WebDesktopManager on it. I call it from panes of windows using the parent.parent.getWindow function
function addWindow(name, text, imageURL, contentURL, width, height, allowMin, allowMax, allowClose) { var dm = ISGetObject("WebDesktopManager1"); var wnd = dm.GetWindow(name); if (wnd == null) { wnd = new WebDesktopWindow(); wnd.Text = text; wnd.Name = name; wnd.ControlBoxImage = "is_webdesktop-16.gif"; wnd.ContentURL = contentURL; wnd.ContentMode = "UseIFrame"; wnd.AllowMinimize = allowMin; wnd.AllowMaximize = allowMax; wnd.AllowClose = allowClose; dm.Windows.Add(wnd); wnd.Show(); wnd.ResizeTo(width, height); wnd.MoveToCenterDesktop(); } else { wnd.Activate(); wnd.Show(); } }
Clearly there must be a better way to access the WebDesktopManager via Javascript from within a Window other than using the parent.Function() method.
It's especially complicated in my situation where the window has a WebPane which an IFrame which has a Master Page which then loads an IFrame in a WebTab.
As expressed above, since I have various WebPanes and nested WebTabs in various pages, I was having problems accessing the WebDesktopManager via JavaScript since the number of "parents" varies depending on how many nested IFrames I have.
As a work around, I've created a class named LinkManager which automatically will create the links for me, and has a parameter to specify the "parentDepth".
While this works, it would be nicer if there was a way to access WebDesktopManager on child pages without using "parent". Please let me know if this is possible.
Is it a bad practice to have multiple nested IFrames. I realize each one is a seperate web page that needs loaded and thus is more of a load on the server -- but it's my understanding this is a much cleaner way to organize WebPane's and WebTabs as opposed to InLineContent, correct?
public static string GetAddWindowCode(string wndName, string wndText, string wndImageURL, string wndContentURL, int width, int height, bool allowMinimize, bool allowMaximize, bool allowClose) { return string.Format("addWindow('{0}', '{1}', '{2}', '{3}', {4}, {5}, '{6}', '{7}', '{8}');", wndName, wndText, wndImageURL, wndContentURL, width, height, GetYesorNo(allowMinimize), GetYesorNo(allowMaximize), GetYesorNo(allowClose)); // this calls the javascript function on the parentpage that contains WebDesktopManager } public static string GetAddWindowCode(string wndName, string wndText, string wndImageURL, string wndContentURL, int width, int height, bool allowMinimize, bool allowMaximize, bool allowClose, int parentDepth) { string parentString = ""; for (int i = 0; i < parentDepth; i++) { parentString += "parent."; } return string.Format("{0}{1}", parentString, GetAddWindowCode(wndName, wndText, wndImageURL, wndContentURL, width, height, allowMinimize, allowMaximize, allowClose)); } public static string GetAddWindowLink(string linkText, string wndName, string wndText, string wndImageURL, string wndContentURL, int width, int height, bool allowMinimize, bool allowMaximize, bool allowClose, int parentDepth) { string parentString = ""; for (int i = 0; i < parentDepth; i++) { parentString += "parent."; } return string.Format("<a href=# OnClick=\"{0}{1}\">{2}</a>", parentString, GetAddWindowCode(wndName, wndText, wndImageURL, wndContentURL, width, height, allowMinimize, allowMaximize, allowClose), linkText); } public static string GetAddWindowLink(string linkText, string wndName, string wndText, string wndImageURL, string wndContentURL, int width, int height, bool allowMinimize, bool allowMaximize, bool allowClose) { return GetAddWindowLink(linkText, wndName, wndText, wndImageURL, wndContentURL, width, height, allowMinimize, allowMaximize, allowClose, 0); } public static string GetYesorNo(bool value) { if (value) return "Yes"; return "No"; }
Just to help the community, here is the JavaScript addWnidow function which resides on the actual .aspx with WebDesktopManager1
Unfortunately, when you are using iFrame you will not be able to access the parent functionality & object without referencing it. In your case, perhaps using multiple .parent() function in order to get the WebDesktopManger object.
Thank you for the workaround snippet you provided, it will be useful when we are using complex WebDesktopManger.
Thanks, I will continue to use the syntax:
parent.parent.parent.parent.functionName(paramets);
to invoke JavaScript functions on my WebDesktopManager page.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname