[Laszlo-user] LzParsedPath localdataset
William Krick
wkrick at eio-online.com
Fri Jun 16 12:34:03 EDT 2006
I don't know if this will help your situation or not but this is the code
that we use to load our dataset URLs from an external XML file. We need to
do this because we test our app locally as a proxied app, but deploy it as a
SOLO app. A solo app requires the URLs to be relative. Having the URLs in
an external file allows us to swap out the URLs by changing that file. No
need to touch the code...
This is the code in "canvas"...
<dataset name="ds_paths" request="true" type="http" src="paths.xml" />
<dataset name="ds1"/>
<datapointer xpath="ds_paths:/paths/ds1">
<method event="ondata">
parent.ds1.setAttribute( 'src', this.getNodeText() );
</method>
</datapointer>
<dataset name="ds2"/>
<datapointer xpath="ds_paths:/paths/ds2">
<method event="ondata">
parent.ds2.setAttribute( 'src', this.getNodeText() );
</method>
</datapointer>
<dataset name="ds3"/>
<datapointer xpath="ds_paths:/paths/ds3">
<method event="ondata">
parent.ds3.setAttribute( 'src', this.getNodeText() );
</method>
</datapointer>
The contents of paths.xml looks something like this...
<paths>
<ds1>http://www.domain.com/dsservlet/getds1</ds1>
<ds2>http://www.domain.com/dsservlet/getds2</ds2>
<ds3>http://www.domain.com/dsservlet/getds3</ds3>
</paths>
Hmm... looking at the datapointer code above, it could
probably simplified a little too...
<datapointer xpath="ds_paths:/paths/ds1"
ondata="parent.ds1.setAttribute('src',this.getNodeText())" />
-----Original Message-----
From: Not Zippy [mailto:notzippy at gmail.com]
Sent: Friday, June 16, 2006 12:14 PM
To: laszlo-user at openlaszlo.org
Subject: [Laszlo-user] LzParsedPath localdataset
Hi
I have a class similar to the following
<class name="foo">
<dataset name="myLocalds">
<datapointer name="mydp" xpath="local:classroot.myLocalds:/element[2]"/>
</class>
And I get
WARNING: local dataset "classroot,myLocalds" not found in #foo
Looking through the code it appears the datapointer is using
var q = new _root.LzParsedPath( pa, this);
to parse the xpath.
However in LzParsedPath the following code is commented out
if ( name == "new" ){
//_root.Debug.write( "setting to anondset" );
this.context = new this.AnonDatasetGenerator( this );
/* } else if ( name == "localdata" ) {
this.context = node.getLocalDataContext();
_root.Debug.write('found local dataset 2', this.context);
this.islocaldata = true;
*/
} else {
this.context = _root.canvas.datasets[ name ];
}
Is there a better way to create a datapointer pointing to a localdataset ?
Thanks
_______________________________________________
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