There are some examples here: 
http://www.openlaszlo.org/lps3/docs/guide/data-tutorial.html#data-tutorial.http

And this one way to do it:

<canvas width="100%" height="600" proxied="false">
        
        <dataset name="myData">
                <entries>
                        <element>20</element>
                        <element>12</element>
                        <element>2009</element>
                </entries>
        </dataset>                
        
        <text datapath="myData:/entries">
        <handler name="ondata">
                var pointer = new lz.datapointer();
                Debug.write(pointer);
                pointer.setXPath(this.datapath);
                var day = pointer.xpathQuery("element[1]/text()");
                var month = pointer.xpathQuery("element[2]/text()");
                var year = pointer.xpathQuery("element[3]/text()");
            this.setAttribute('text', day + '.' + month + '.' + year);
        </handler>
   </text>
        
</canvas>

Cheers,
Raju

On Aug 19, 2009, at 5:51 PM, Torsten Curdt wrote:

I have a dataset

 <dataset name="result">
   <value id="day">13</value>
   <value id="month">01</value>
   <value id="year">2009</value>
 </dataset>

and a <text/> field. Binding the textfield to a single value (e.g.
just day) I worked out.
But what I need the text field to be a composite of all the 3 values.

My idea was to bind the text field to the dataset and in a handler
update the text. Something along the lines of

   <text datapath="result:/">
       <handler name="ondata">
           Debug.write('data has changed');
           var day = ...
           var month = ...
           var year = ...
           this.setAttribute('text', day + '.' + month + '.' + year);
       </handler>
   </text>

But there are two problems:

a) this is only getting called once. (wrong datapath? do I need to
bind against all 3 nodes?)
b) how can I query a value from a dataset in javascript??

               var day = this.xpathQuery("result:/val...@id='day']");
               var month = result.xpathQuery("/val...@id='month']");

Neither of the two approaches worked.

Any pointers?

cheers
--
Torsten

Reply via email to