OLaszloFan
03-07-2007, 02:22 PM
Hi:
I am interested in being able to change an external xml source file reference in a local dataset which is used within a class.
I updated the example so that with each class calls an alternate xml source is referenced. Note: I used the same reference to simply the example.
I am not sure why I can't get the weather data to update and display following the push of the Fetch Weather button. Can anyone please try my code and help me problem solve.
Appreciate the help.
Patrick
<canvas debug="true">
<class name='weatherBug' extends="window" height="300" width="400" closeable='true' title="Get Weather">
<attribute name="dsetsource" value="http://www.laszlosystems.com/cgi-pub/weather.cgi?zip=" type="string" />
<dataset name="weatherdata" request="false" src="http://" ondata="classroot.txtURL.setText(classroot.weatherdata.src )" />
<simplelayout axis="y" />
<text>Enter a Zipcode:</text><simpleinputtext name='zip' width='100'>11023</simpleinputtext >
<button>Fetch Weather
<handler name="onclick" ><![CDATA[
var z = "${classroot.dsetsource}" + classroot.zip.getText();
local:classroot.weatherdata.setSrc(z);
local:classroot.weatherdata.doRequest();
]]></handler>
</button>
<grid datapath="local:classroot.weatherdata:/weather" contentdatapath="forecast/day" width="100%" />
<text name='txtURL' width="100%" ><i>(weatherdata.src)</i></text>
</class>
<weatherBug name="weatherBug1" x="200">
<attribute name="dsetsource" value="http://www.laszlosystems.com/cgi-pub/weather.cgi?zip=" type="string" />
</weatherBug>
<weatherBug name="weatherBug2" y="20">
<attribute name="dsetsource" value="http://www.laszlosystems.com/cgi-pub/weather.cgi?zip=" type="string" />
</weatherBug>
<button y="310" >Launch Another Instance
<handler name="onclick" ><![CDATA[
var temp = new weatherBug();
]]></handler>
</button>
</canvas>
I am interested in being able to change an external xml source file reference in a local dataset which is used within a class.
I updated the example so that with each class calls an alternate xml source is referenced. Note: I used the same reference to simply the example.
I am not sure why I can't get the weather data to update and display following the push of the Fetch Weather button. Can anyone please try my code and help me problem solve.
Appreciate the help.
Patrick
<canvas debug="true">
<class name='weatherBug' extends="window" height="300" width="400" closeable='true' title="Get Weather">
<attribute name="dsetsource" value="http://www.laszlosystems.com/cgi-pub/weather.cgi?zip=" type="string" />
<dataset name="weatherdata" request="false" src="http://" ondata="classroot.txtURL.setText(classroot.weatherdata.src )" />
<simplelayout axis="y" />
<text>Enter a Zipcode:</text><simpleinputtext name='zip' width='100'>11023</simpleinputtext >
<button>Fetch Weather
<handler name="onclick" ><![CDATA[
var z = "${classroot.dsetsource}" + classroot.zip.getText();
local:classroot.weatherdata.setSrc(z);
local:classroot.weatherdata.doRequest();
]]></handler>
</button>
<grid datapath="local:classroot.weatherdata:/weather" contentdatapath="forecast/day" width="100%" />
<text name='txtURL' width="100%" ><i>(weatherdata.src)</i></text>
</class>
<weatherBug name="weatherBug1" x="200">
<attribute name="dsetsource" value="http://www.laszlosystems.com/cgi-pub/weather.cgi?zip=" type="string" />
</weatherBug>
<weatherBug name="weatherBug2" y="20">
<attribute name="dsetsource" value="http://www.laszlosystems.com/cgi-pub/weather.cgi?zip=" type="string" />
</weatherBug>
<button y="310" >Launch Another Instance
<handler name="onclick" ><![CDATA[
var temp = new weatherBug();
]]></handler>
</button>
</canvas>