William,

The reason the example doesn't work is because a replication manager is only created when the datapath points to 2 or more nodes. Since there is no replication manager, no onclones event is ever fired.

A potential work around is to initially point the datapath to 2 or more nodes, and then switch it to the 'real' dataset.

-chrisk

On Dec 27, 2005, at 2:28 PM, William Krick wrote:

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

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

Reply via email to