felasfa
07-08-2003, 07:56 PM
I am trying to set the datapath of a view dynamically on user input
In this example, what I want to happen is the second window to reflect the user choice in the first one.
I don't want to just pass the selected text since I want later to be able to traverse the dataset in the second window.
So..
How do I find out the xpath of the view instance in the first window ? It appears the replication manager takes over the views and I'm not sure how to obtain the current xpath.
Also, how do I fire the "data" event in the second window to let it know that it's dataset has been changed and it needs to update its view ?
any help would be appreciated.
canvas debug="true" height="800" width="800">
<debug height="200" width="600" x="50" y="450"/>
<dataset name="fruits">
<fruit>Oranges</fruit>
<fruit>Apples</fruit>
<fruit>Bananas</fruit>
<fruit>Grapes</fruit>
<fruit>Kiwis</fruit>
<fruit>Papayas</fruit>
<fruit>Watermelon</fruit>
<fruit>Strawberries</fruit>
<fruit>Cherries</fruit>
</dataset>
<simplelayout axis="x"/>
<window x="50" y="50" width="100" height="300">
<view bgcolor="0xffff00" width="this.immediateparent.width" height="this.immediateparent.height">
<simplelayout axis="y" spacing="10"/>
<view onclick="send_datapath()" datapath="fruits:/fruit" clickable="true" bgcolor="0xffffff">
<text datapath="text()" resizable="true"/>
<method name="send_datapath">
<![CDATA[
debug.write("this.datapath= "+this.datapath);
two.datapath= this.datapath;
]]>
</method>
</view>
</view>
</window>
<window id="two" x="150" y="50" width="100" height="300">
<view id="two">
<text>selected fruit is:</text>
<text datapath="text()" resizable="true"/>
</view>
</window>
</canvas>
In this example, what I want to happen is the second window to reflect the user choice in the first one.
I don't want to just pass the selected text since I want later to be able to traverse the dataset in the second window.
So..
How do I find out the xpath of the view instance in the first window ? It appears the replication manager takes over the views and I'm not sure how to obtain the current xpath.
Also, how do I fire the "data" event in the second window to let it know that it's dataset has been changed and it needs to update its view ?
any help would be appreciated.
canvas debug="true" height="800" width="800">
<debug height="200" width="600" x="50" y="450"/>
<dataset name="fruits">
<fruit>Oranges</fruit>
<fruit>Apples</fruit>
<fruit>Bananas</fruit>
<fruit>Grapes</fruit>
<fruit>Kiwis</fruit>
<fruit>Papayas</fruit>
<fruit>Watermelon</fruit>
<fruit>Strawberries</fruit>
<fruit>Cherries</fruit>
</dataset>
<simplelayout axis="x"/>
<window x="50" y="50" width="100" height="300">
<view bgcolor="0xffff00" width="this.immediateparent.width" height="this.immediateparent.height">
<simplelayout axis="y" spacing="10"/>
<view onclick="send_datapath()" datapath="fruits:/fruit" clickable="true" bgcolor="0xffffff">
<text datapath="text()" resizable="true"/>
<method name="send_datapath">
<![CDATA[
debug.write("this.datapath= "+this.datapath);
two.datapath= this.datapath;
]]>
</method>
</view>
</view>
</window>
<window id="two" x="150" y="50" width="100" height="300">
<view id="two">
<text>selected fruit is:</text>
<text datapath="text()" resizable="true"/>
</view>
</window>
</canvas>