sfarrow
07-21-2003, 08:26 AM
I am experiencing some unexpected behaviour with replication. In the example below, my dataset has a number of blue elements and within each there are zero or more green elements and zero or more red elements.
By setting blue view containing a red and a green view and letting LzReplicationManager do its stuff, I am getting more subviews than I expect. In the case where a red or green element is not present in the blue element, I still get a subview for it.
In the project that I am working on, I have an event handler for onaddsubview. If I add a green element to a blue element which does not have a green element, I do not get the onaddsubview event. Instead it simply uses the "phantom" subview it had previously created.
In this example below, clicking on a blue view dumps information about its subviews.
<canvas debug="true">
<dataset name="myds">
<blue id="One">
<green id="G1"/>
</blue>
<blue id="Two">
<green id="G1"/>
<red id="R1"/>
</blue>
<blue id="Three">
<red id="R1"/>
</blue>
<blue id="Four">
</blue>
</dataset>
<view datapath="myds:/blue" clickable="true">
<method event="onclick">
for(i in this.subviews) {
Debug.write(" subviews["+i+"]: " + this.subviews[i]);
Debug.write(" subviews["+i+"].height: " + this.subviews[i].height);
Debug.write(" subviews["+i+"].data: " + this.subviews[i].datapath.serialize());
}
</method>
<text datapath="@id" bgcolor="blue"/>
<view datapath="green" height="15" bgcolor="green">
<text datapath="@id"/>
</view>
<view datapath="red" height="15" bgcolor="red">
<text datapath="@id"/>
</view>
<simplelayout axis="y"/>
</view>
<simplelayout axis="y" spacing="10"/>
</canvas>
By setting blue view containing a red and a green view and letting LzReplicationManager do its stuff, I am getting more subviews than I expect. In the case where a red or green element is not present in the blue element, I still get a subview for it.
In the project that I am working on, I have an event handler for onaddsubview. If I add a green element to a blue element which does not have a green element, I do not get the onaddsubview event. Instead it simply uses the "phantom" subview it had previously created.
In this example below, clicking on a blue view dumps information about its subviews.
<canvas debug="true">
<dataset name="myds">
<blue id="One">
<green id="G1"/>
</blue>
<blue id="Two">
<green id="G1"/>
<red id="R1"/>
</blue>
<blue id="Three">
<red id="R1"/>
</blue>
<blue id="Four">
</blue>
</dataset>
<view datapath="myds:/blue" clickable="true">
<method event="onclick">
for(i in this.subviews) {
Debug.write(" subviews["+i+"]: " + this.subviews[i]);
Debug.write(" subviews["+i+"].height: " + this.subviews[i].height);
Debug.write(" subviews["+i+"].data: " + this.subviews[i].datapath.serialize());
}
</method>
<text datapath="@id" bgcolor="blue"/>
<view datapath="green" height="15" bgcolor="green">
<text datapath="@id"/>
</view>
<view datapath="red" height="15" bgcolor="red">
<text datapath="@id"/>
</view>
<simplelayout axis="y"/>
</view>
<simplelayout axis="y" spacing="10"/>
</canvas>