Check documentation for the latest version of dhtmlxSuite Loading from HTML Object DHTMLX Docs

Loading from HTML Object

loadFromHTML() method loads content from HTML object to the menu. First, the user should create this HTML object. For example:

<body> 
  <div id="menuData" style="display: none;">  
     <div id="m1" text="File"> // the first top menu item
        <div id="m11" text="New"><hotkey>Ctrl+N</hotkey></div>  //the first child item
        <div id="ms1" type="separator"></div> // a separator    
        <div id="m12" text="Open"><hotkey>Ctrl+O</hotkey></div> //the second child item  
     </div>    
  </div>
</body>

Then loadFromHTML() should be applied with the following parameters:

  • objectId - id of data container ("menuData" in our case);
  • clear - true/false, removes HTML object after data was loaded, if this parameter is set to true;
  • onLoadFunction - a user-defined handler, which will be called, when the data is loaded (optional).
myMenu.loadFromHTML("menuData", true, function(){
    alert("Menu was loaded from HTML Object.");
});
Back to top