[Laszlo-user] accessing datasets within classes

graphis1@mac.com graphis1 at mac.com
Mon Mar 27 15:15:09 EST 2006


Thanks very much for your replies Raju - the first method you posted  
works well, but the view doesn't update when the dataset is refreshed.

The following works great, but updates to the dataset don't update  
the view:

<canvas>
   <include href = "../datatest.lzx" />
   <datatest name = "allNames" />
   <view>
      <datapath xpath = "allNames:listNames:/records/name" />
      <text datapath = "@firstname" />
   </view>
</canvas>

Is this intended for static data only, or could it be easily adapted  
for dynamic data without using setters in the view itself? (As in the  
second solution you posted.)

Best wishes,

Nick



On 27 Mar 2006, at 20:01, Raju Bitter wrote:

>
> Sorry, I misunderstood your question:
>
> <canvas debug="true" width="1000" height="500">
> 	<include href = "thelib.lzx" />
>
> 	<datatest name="dt">
> 		<datapointer xpath="local:listNames:/*"
> ondata="testView.process()" />
> 	</datatest>
>
> 	<view name="testView">
> 		 <method name="process">
> 			 this.dataPointer = dt.listNames.getPointer();
> 			 dataPointer.setXPath('/records/name');
> 	
> myText.setText(dataPointer.getNodeAttribute('firstname'));
> 		 </method>
> 		 <text name="myText" resize="true"/>
> 	</view>
> 	
> </canvas>
>
> That way the dataset can be accessed by using a datapointer. By I  
> don't know
> how to set a datapath from outsite the 'dt' object to the local  
> dataset.
>
> Best,
>
> Raju
> -----Ursprüngliche Nachricht-----
> Von: Raju Bitter [mailto:rajubitter at web.de]
> Gesendet: Montag, 27. März 2006 21:01
> An: 'Raju Bitter'
> Betreff: RE: [Laszlo-user] accessing datasets within classes
>
> Sorry, I misunderstood your question:
>
> <canvas debug="true" width="1000" height="500">
> 	<include href = "thelib.lzx" />
>
> 	<datatest name="dt">
> 		<datapointer xpath="local:listNames:/*"
> ondata="testView.process()" />
> 	</datatest>
>
> 	<view name="testView">
> 		 <method name="process">
> 			 this.dataPointer = dt.listNames.getPointer();
> 			 dataPointer.setXPath('/records/name');
> 	
> myText.setText(dataPointer.getNodeAttribute('firstname'));
> 		 </method>
> 		 <text name="myText" resize="true"/>
> 	</view>
> 	
> </canvas>
>
> That way the dataset can be accessed by using a datapointer. By I  
> don't know
> how to set a datapath from outsite the 'dt' object to the local  
> dataset.
>
> Best,
>
> Raju
>
>
> -----Ursprüngliche Nachricht-----
> Von: laszlo-user-bounces at openlaszlo.org
> [mailto:laszlo-user-bounces at openlaszlo.org] Im Auftrag von  
> graphis1 at mac.com
> Gesendet: Montag, 27. März 2006 12:08
> An: laszlo-user at openlaszlo.org
> Betreff: [Laszlo-user] accessing datasets within classes
>
>
> How do I reference a dataset from the canvas when it's called from an
> external class?
>
> Here's a very simplified test case, running solo under OL3.2
>
> The datatest.lzx class:
>
> <library>
>   <class name = "datatest" extends = "node" />
>       <dataset name = "listNames" request = "true" type = "http" src =
> "/names/records/" />
>   </class>
> </library>
>
>
> And the simplified canvas:
>
> <canvas>
>   <include href = "../datatest.lzx" />
>   <datatest />
>   <view>
>      <datapath xpath = "listNames:/records/name" />
>      <text datapath = "@firstname" />
>   </view>
> </canvas>
>
> The debugger returns "could not find dataset for listNames."
> What do I need to change for the dataset to be visible to the canvas?
>
> Many thanks
>
>
>
>
> _______________________________________________
> Laszlo-user mailing list
> Laszlo-user at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>
>
> _______________________________________________
> Laszlo-user mailing list
> Laszlo-user at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>
>
> _______________________________________________
> Laszlo-user mailing list
> Laszlo-user at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user





More information about the Laszlo-user mailing list