23-Apr-05 (Created: 23-Apr-05) | More in 'laszlo'

laszlo: Getting your feet wet Example 2: A Dynamic tree

Designing a dynamic tree


<canvas height="620">
<include href="lz/tree.lzx"/>
 <dataset type="http" name="foldersDataSet" 
    request="true"
    src="http://localhost:8181//akc/display"
   querystring="url=abc&ownerUserId=xyz&aspire_output_format=object-xml"/>

<!--
************************************************
* Simple working tree
************************************************
-->   
<simplelayout axis="x" spacing="200"/>
<window width="200" title="Sample simple tree">
     <view width="200" height="200">
      <tree open="true" text="valuemeal">
        <tree text="fries" isleaf="true"/>
        <tree open="true" text="drink">
          <tree text="cola" isleaf="true"/>
        </tree>
        <tree open="true" text="burger">
          <tree text="patty" isleaf="true"/>
          <tree text="lettuce" isleaf="true"/>
          <tree text="onions" isleaf="true"/>
          <tree text="buns" isleaf="true"/>
        </tree>
      </tree>
    </view>
</window>

<!--
************************************************
* A first cut at a dynamic tree
************************************************
-->   
<window width="200" x="210">
   <view width="200" height="200">
      <simplelayout axis="y" spacing="10"/>
      <tree datapath="foldersDataSet:/AspireDataSet/FoldersLoop1" 
            text="CCP Folders" icon="null" 
            showroot="false" 
            onselected="canvas.myalert.open()">
            
         <tree  datapath="*" text="$path{'folder_name/text()'}" recurse="false">
            <method event="onopen">
               canvas.myalert.setAttribute('text', this.text);
               canvas.myalert.open();
            </method>
         </tree>
         </tree>
     </view>
</window>

<!--
************************************************
* A small attempt at a workable alert
************************************************
-->   
<alert name="myalert" width="100" y="330">
   hi
</alert>

<!--
************************************************
* Testing the alert
************************************************
-->   
<button y="300" onclick="canvas.myalert.open()">Show Alert</button>

<method name="hi">
   canvas.myalert.open();
</method>
</canvas>