data_app-$9.lzx

<canvas height="200" width="100%" bgcolor="#D4D0C8">
  <dataset name="dset" src="resources/phonebook.xml"/> 
  <class name="contactview" extends="view" visible="false" x="20" height="120">
    <text y="10">First Name:</text>
    <edittext name="firstName" datapath="@firstName" x="80" y="10"/>
    <text y="35">Last Name:</text>
    <edittext name="lastName" datapath="@lastName" x="80" y="35"/>
    <text y="60">Phone:</text>
    <edittext name="phone" datapath="@phone" x="80" y="60"/>
    <text y="85">Email:</text>
    <edittext name="email" datapath="@email" x="80" y="85"/>
  </class>
  <simplelayout axis="y"/>
  <view>
    <simplelayout axis="y"/>
    <text onclick="parent.newContact.setAttribute('visible', !parent.newContact.visible);">New Entry...</text>
    <contactview name="newContact" datapath="new:/contact">
      <button width="80" x="200" y="10">Add
        <handler name="onclick">
          parent.datapath.updateData();
          var dp=canvas.datasets.dset.getPointer();
          dp.selectChild();
          dp.addNodeFromPointer( parent.datapath );
          parent.setAttribute('visible', false);
          parent.setAttribute('datapath', "new:/contact");
        </handler>
      </button>
    </contactview>
  </view>
  <view datapath="dset:/phonebook/contact">
    <simplelayout axis="y"/>
    <view name="list" onclick="parent.updateContact.setAttribute('visible', !parent.updateContact.visible);">
      <simplelayout axis="x"/>
      <text datapath="@firstName"/>
      <text datapath="@lastName"/>
      <text datapath="@phone"/>
      <text datapath="@email"/>
    </view>
    <contactview name="updateContact">
      <button width="80" x="200" y="10">Update
        <handler name="onclick">
          parent.parent.datapath.updateData();
        </handler>
      </button>
      <button width="80" x="200" y="40">Delete
        <handler name="onclick">
          parent.parent.datapath.deleteNode();
        </handler>
      </button>
    </contactview>
  </view>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2007 - 2009 Laszlo Systems, Inc.  All Rights Reserved.            *
* Use is subject to license terms.                                            *
* X_LZ_COPYRIGHT_END ****************************************************** -->

Cross References

Classes

Named Instances