Check documentation for the latest version of dhtmlxSuite Loading Data from XML DHTMLX Docs

Loading Data from XML

Loading Data from XML File

The loadStruct() method loads the ribbon data from an XML file. When the data is loaded into the object, a user-defined handler is called (onLoadFunction), if it was indicated by user. All the data is loaded at once:

myRibbon.loadStruct("[path to this file]/file.xml", onLoadFunction);
onLoadFunction = function(){
    // data loaded and rendered
    // your code here
};

The first parameter of loadStruct() method is the path to the XML file, while the second parameter is an optional user-defined handler.

Loading Data from XML String

The loadStruct() method loads ribbon data from XML string as well. When the data is loaded into the object, a user-defined handler is called. All the data is loaded at once:

myRibbon.loadStruct("<data><node id="a1".../></data>", onLoadFunction);
onLoadFunction = function(){
    // data loaded and rendered
    // your code here       
};

XML Format Template

This section is created in order to give the user the idea of XML Format Template. It aims at helping users in creating XML files for dhtmlxRibbon initialization.

<ribbon>
  <tab text="tab1" active="true">
    <item type="block" text="Buttons" mode="cols">
     <item type="button" text="New" isbig="true" img="48/new.gif" imgdis="48/open.gif"/>
     <item type="button" text="copy" isbig="flae" img="18/copy.gif"/>
     <item type="button" text="cut" img="18/cut.gif"/>
     <item type="button" text="New" img="18/new.gif"/>
     <item type="button" text="open" isbig="true" img="48/open.gif"/>
     <item type="newLevel"/>
     <item type="button" text="paste" img="18/paste.gif"/>
     <item type="button" text="print" img="18/print.gif"/>
    </item>
    <item type="block" text="ButtonsTwoState" text_pos="top">
      <item type="buttonTwoState" text="new" img="18/new.gif" state="true"/>
      <item type="buttonTwoState" text="open" img="18/open.gif"/>
      <item type="buttonTwoState" text="cut" img="18/cut.gif"/>
      <item type="buttonTwoState" text="save" img="48/save.gif" isbig="true"/>
    </item>
  </tab>
  <tab text="tab2">
    <item type="block" text="mix" mode="rows" text_pos="top">
      <item type="button" text="new" img="18/new.gif"/>
      <item type="button" text="open" img="18/open.gif"/>
      <item type="newLevel"/>
      <item type="button" text="paste" img="18/paste.gif"/>
      <item type="button" text="print" img="18/print.gif"/>
      <item type="buttonTwoState" img="48/save.gif" isbig="true"/>
      <item type="button" text="cut" img="18/cut.gif"/>
      <item type="newLevel"/>
      <item type="button" text="New" img="18/new.gif"/>
      <item type="newLevel"/>
      <item type="buttonTwoState" text="open" img="18/open.gif"/>
      <item type="newLevel"/>
      <item type="buttonTwoState" text="new" img="18/new.gif" state="true"/>
    </item>
  </tab>
</ribbon>
Back to top