Sample: dhtmlxToolbar Add / delete button dhtmlxToolbar main page
X

There is an opportunity to add and delete buttons using addItem and removeItemById methods

  Click on any existing button to delete it
Add new image button
Add new image button with text 
Add new select button
Add divider

 
<div id="toolbar_zone" style="width:600;border :1px solid Silver;"/>
<script>
 
    //init toolbar
    aToolBar=new dhtmlXToolbarObject('toolbar_zone','100%',30,"Demo toolbar");
    // set processing function
    aToolBar.setOnClickHandler(onButtonClick);
    //load toolbar from xml
    aToolBar.loadXML("_toolbar.xml")
    //show toolbar
    aToolBar.showBar();
    
    //add new button
    aToolBar.addItem(new dhtmlXImageButtonObject('icon21.gif',20,18,0,'new_Id','New tooltip'))
    //delete button 
    aToolBar.removeItemById(itemId);
</script>

Parameters passed to the constructor are:
  • object to attach toolbar to (should be loaded before calling constructor)
  • width of the toolbar
  • height of the toolbar
  • title of the toolbar