Salicar
09-06-2006, 02:18 AM
Hi all,
I hope you can help me with this issue it has been causing me many a frustrating hour.
I am trying to do the following:
Bind an image dynamically to a view where the url is formed from a datapath provided to the binding.
<canvas height="100%" width="100%" title="Testing Site">
<!--
statedataset.xml
<states>
<state portal_count_flg="Y" state_id="1"/>
<state portal_count_flg="Y" state_id="3"/>
<state portal_count_flg="Y" state_id="4"/>
<state portal_count_flg="Y" state_id="5"/>
</states>
-->
<dataset name="statedataset" type="http" request="false" src="./statedataset.xml">
<handler name="ondata">
Debug.write('ondata flicker');
</handler>
</dataset>
<handler name="oninit">
canvas.tick();
</handler>
<method name="tick">
this.refreshDelegate = new LzDelegate( this, "tickprogress" );
LzTimer.addTimer( this.refreshDelegate, 10000);
</method>
<method name="tickprogress">
statedataset.doRequest();
this.tick()
</method>
<class name="testing">
<simplelayout axis="x" spacing="5"/>
<view datapath="state[@portal_count_flg='Y']" source="${'resources/images/small_state_' + this.datapath.xpathQuery('@state_id') + '_icon.png'}"/>
</class>
<testing>
<datapath xpath="statedataset:/states" pooling="true"/>
</testing>
</canvas>
As you can see above it willl cause a flicker on each ondata event from the dataset. This is because the source paramater is rebound upon each doRequest call. Fair enough what i expected.
So by switching to using source="$once it only gets set once. However the results here are dependant upon the dataset being retrieved quicker than the oninit event triggering!
Ideally i want an ondata event which only triggers once. I can get by this by putting an If statement into the ondata but that it hardly ideal.
Should i be using initstage somehow?
Please help really struggling with this minor issue.
Regards,
Richard
I hope you can help me with this issue it has been causing me many a frustrating hour.
I am trying to do the following:
Bind an image dynamically to a view where the url is formed from a datapath provided to the binding.
<canvas height="100%" width="100%" title="Testing Site">
<!--
statedataset.xml
<states>
<state portal_count_flg="Y" state_id="1"/>
<state portal_count_flg="Y" state_id="3"/>
<state portal_count_flg="Y" state_id="4"/>
<state portal_count_flg="Y" state_id="5"/>
</states>
-->
<dataset name="statedataset" type="http" request="false" src="./statedataset.xml">
<handler name="ondata">
Debug.write('ondata flicker');
</handler>
</dataset>
<handler name="oninit">
canvas.tick();
</handler>
<method name="tick">
this.refreshDelegate = new LzDelegate( this, "tickprogress" );
LzTimer.addTimer( this.refreshDelegate, 10000);
</method>
<method name="tickprogress">
statedataset.doRequest();
this.tick()
</method>
<class name="testing">
<simplelayout axis="x" spacing="5"/>
<view datapath="state[@portal_count_flg='Y']" source="${'resources/images/small_state_' + this.datapath.xpathQuery('@state_id') + '_icon.png'}"/>
</class>
<testing>
<datapath xpath="statedataset:/states" pooling="true"/>
</testing>
</canvas>
As you can see above it willl cause a flicker on each ondata event from the dataset. This is because the source paramater is rebound upon each doRequest call. Fair enough what i expected.
So by switching to using source="$once it only gets set once. However the results here are dependant upon the dataset being retrieved quicker than the oninit event triggering!
Ideally i want an ondata event which only triggers once. I can get by this by putting an If statement into the ondata but that it hardly ideal.
Should i be using initstage somehow?
Please help really struggling with this minor issue.
Regards,
Richard