Chapter 27. Delegates, section 4.

This example does not work when there is only one item in the list...



<canvas height="150"> 
    <dataset name="people">
        <people> 
            <person name="John"/> 
          <!--
            <person name="Eric"/> 
            <person name="Andrew"/> 
            <person name="chrisk"/> 
            <person name="Sarah"/> 
            <person name="Pablo"/> 
            <person name="Adam"/> 
          -->
        </people>
    </dataset> 

    <view>
        <text>
            <datapath xpath="people:/people/person/@name">
                <method event="onclones">
                    var lastclone = this.clones[ this.clones.length - 1 ];

                    if( typeof this.del == "undefined" ) {
                        this.del = new LzDelegate( this, "replicationComplete") 
                    } else {
                        this.del.ungregisterAll();
                    }

                    this.del.register( lastclone, "oninit"); 
                </method>

                <method name="replicationComplete">
                    lastRepText.setText("The last view has been replicated"); 
                </method>
            </datapath>
        </text>
        <simplelayout axis="y"/>
    </view>

    <text id="lastRepText" bgcolor="green" resize="true"> 
        Replication incomplete
    </text>
   
    <simplelayout axis="y"/> 
</canvas> 


_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to