Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Randall on Jan 29, 2009 13:54
open dhtmlx forum
menu item launch on page load

I have a parent page with a menu that opens dhtmlx windows with sub pages in them. I am trying to come up with a way to be able to link to the main page, and have any number of the menu items open there respective window. In a nut shell this would allow me to send a link to someone and that link open via the home page.

the menu has an onlick event attached.

menu.addNewSibling(null, "window1", "window1", false,"");

menu.attachEvent("onClick", function(id){
if (id="window1"){"open window code"}
}


if i had the page recieve a variable such as "window1"

how could i have that event fired (using js) to call up the appropriate window code?
Answer posted by Support on Feb 03, 2009 08:24
Menu does not provide such functionality.

You can save clicked links in "onClick" event, then write a little parser-script which will parse and then open saved links.
Answer posted by Randall on Feb 04, 2009 05:45

for anyone else looking for a solution to this, it seems to work if you add a name to the onclick function, such as...

menu.attachEvent("onClick", function checkID(id){

     if (id=="Basic") {'open a window';}  
});

then further down in the code you can do whatever conditions you want, and call the function "checkID" or whatever you named it, and of course pass the id you would like to have checked in your "if" statements.

<script>checkID("<%=window%>")</script>

in the above case i grab a variable sent to the page, and run the "checkID" function at the bottom of the page, to launch a window to a specific page.

i don't know how well this is supported by DHTMLX, but it worked for me.