data-accessing-lzdataelement.lzx

<canvas debug="true" width="100%" bgcolor="0xC9D8EB">

    <debug x="0" y="150" width="450" height="200"/>

    <dataset name="ds" src="./shareddata/contacts_full.xml"/>

    <list id="mylist" datapath="ds:/addressbook/contacts" height="145" width="150">
        <textlistitem name="myitem" datapath="person" text="$path{'@email'}" value="$path{'position()'}"/>
    </list>

    <window title="Controls" x="158">
        <simplelayout axis="y" spacing="6" inset="10"/>
        <constantlayout axis="x" value="10"/>
        
        <text fontstyle="bold">
            Following lz.DataElement refers to the "contacts" node
        </text>

        <button>Get lz.DataElement via datapointer
            <handler name="onclick">
                var dp = new lz.datapointer();
                dp.setAttribute("xpath","ds:/addressbook/contacts");
                Debug.debug("%w", dp.p);
            </handler>
        </button>

        <button>Get lz.DataElement via datapath
            <handler name="onclick">
                Debug.debug("%w", mylist.datapath.p);
            </handler>
        </button>

        <button>Create a new lz.DataElement in JavaScript
            <handler name="onclick">
                var newNode = new lz.DataElement('contacts', null, null);
                Debug.debug("%w", newNode);
            </handler>
        </button>

    </window>
    
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2008 Laszlo Systems, Inc.  All Rights Reserved.                   *
* Use is subject to license terms.                                            *
* X_LZ_COPYRIGHT_END ****************************************************** -->

Cross References

Named Instances