Open laszlo

Open laszlo


Datapointers are not bound to views like datapaths are, but they do have a place in the view hierarchy—that is, they "know about" parents and children.
 1 
 2  < datapointer  xpath ="myData:/"  ondata ="processData()" >
 3       < method  name ="processData" >
 4        this.selectChild(2); 
 5        do {
 6          if (this.xpathQuery( '@show' ) == 'south park') {
 7              Debug.write(this.xpathQuery('firstName/text()'));
 8          }
 9        } while (this.selectNext()); 
10       </ method >
11     </ datapointer >
12 
13 

Create data set at runtime

LzDataset:  var  dset  =   new  LzDataset( null , {name: 'mydset'})

$path{} limitations
A limitation of the $path{} constraint is that the expression it contains is evaluated only at the initialization time, that is, an expression such as $path{'mynode[' + i + ']/@attr'} will behave like a $once{} constraint.Custome

Customize the data binding
1  < view  name ="swatch"  width ="200"  height ="30"  
2    datapath ="colors:/value[1]/text()" >
3       < method  name ="applyData"  args ="v" >
4        setBGColor(eval(v))
5        display.setText(v)
6       </ method >
7     </ view >

$path{}


datapath.setdatapointer

<canvas height="150">
<dataset name="phonebook" src="resources/phonebook.xml"/>
<simplelayout axis="x" spacing="20"/>

<view name="contacts" height="150" width="100">
<view bgcolor="0xe0e0e0" datapath="phonebook:/contacts/contact"
onmouseover="setBGColor(0xc0c0c0)" onmouseout="setBGColor(0xe0e0e0)"
onclick="details.datapath.setPointer(this.datapath.p)">
<simplelayout axis="x" spacing="5"/>
<text datapath="@firstName" resize="true"/>
<text datapath="@lastName" resize="true"/>
</view>
<simplelayout spacing="5"/>
</view>

<view id="details" width="150" height="150" bgcolor="0xe0e0e0" fgcolor="blue">
<datapath/>
<text datapath="@firstName"/>
<text datapath="@lastName"/>
<text datapath="@phone"/>
<text datapath="@email"/>
<simplelayout spacing="5"/>
</view>
</canvas>



你可能感兴趣的:(Open laszlo)