Mixing Widgets into an HTML Page: Difference between revisions

No edit summary
 
mNo edit summary
Line 1: Line 1:
[[Zimbra AjaxTk]]->[[DHTML Widget Toolkit]]->[[Widgets]]
== HTML ==
== HTML ==
<pre><nowiki>
<pre><nowiki>

Revision as of 01:47, 20 April 2006

Zimbra AjaxTk->DHTML Widget Toolkit->Widgets

HTML

  <h1>Menu Test</h1>

  <div id="menu_bar">
    & nbsp;
  </div> <!-- menu_bar -->
  


Set up the Shell

Must set to virtual

 var shell = new DwtShell("MainShell", true, null, null, true);
 shell.setVirtual();

Putting a Widget in a <div>

To put a Dwt widget in a <div> , you need to get the document element of the <div> , clear the contents and then reparent the Dwt widget in the element. Here is an example of how to do that.

  // create a toolbar
  var toolbar = new DwtToolBar(parent, "mainMenu", DwtControl.ABSOLUTE_STYLE, 2);

  /*
    ... Here we would have the code to add buttons to the toolbar 
  */

  // Get the div into which we want to place the toolbar
  var div = document.getElementById("menu_bar");

  // Clean out any content
  div.innerHTML = "";

  // Reparent the toolbar's HTML element to the div
  toolbar.reparentHtmlElement(div);
Jump to: navigation, search