Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Paul on Jan 19, 2010 06:55
open dhtmlx forum
dhtmlxMenu init via HTML

Hi,

When trying to add any additional menu options to an item at creation time via loadFromHTML() such as tooltip, href, hotkey IE throws a "Object Required" error. This also occurs with the sample code (http://www.dhtmlx.com/dhxdocs/doku.php?id=dhtmlxmenu:dhtmlxmenu_init_data_loading), the sample also has a missing '>' to close the item div.

Target browser IE7
Versions v2.0 and v2.5

Do you have a working sample please?

Regards,

Paul
Answer posted by Alex (support) on Jan 19, 2010 08:36

Hello,

how do you try to add menu options ? please provide details

Answer posted by Paul on Jan 19, 2010 09:06

Hi,

  Thank you for the quick response. All through <div></div> as per the sample, as soon as you add any additional tags such as <href></href>, <tooltip></tooltip>, <hotkey></hotkey> etc (inside so it is a child element) IE gives the error and the Menu is not shown.

 

<div id="menuObj"></div>

<div id="menuData">
 <div id="m1" text="File">
  <div id="m11" text="New"><hotkey>Ctrl+N</hotkey></div>
  <div id="ms1" type="separator"></div>
  <div id="m12" text="Open"><href>http://www.google.co.uk</href></div>
 </div>
</div>

...

<script>
  var menu = new dhtmlXMenuObject("menuObj");
  menu.setOpenMode("win");
 
http://menu.loadFromHTML("menuData'>menu.loadFromHTML("menuData", true);
</script>


If I leave out the extra options the menu displays and works fine (albeit using events).

Regards,

  Paul

Answer posted by Alex (support) on Jan 19, 2010 09:50

Unfortunately it isn't possible to define hotkey and href as tags. You can try to use menu API instead:

 menu.loadFromHTML("menuData", true);

menu.setHotKey("m11","Ctrl+N");

menu.setHref("m12","http://www.google.co.uk");

Answer posted on Jan 19, 2010 10:22

OK, you might want to take that out of the samples then. I noticed that some references to menu loading by HTML had been removed between v2.0 and v2.5 (samples/01_init/02_init_from_html.html) but the sample remains the same elsewhere.

This is a conversion of an exsting page generated by a cgi script so I was hoping that it wouldn't need to be altered too much. I've taken it out of the childNodes loop and added it as an attribute of the <div> instead.

Thank you for your help.