Forgot to cc laszlo-user
On 2/25/2011 1:40 PM, André Bargull wrote:
Hi David,
this is the expected behaviour for normal replication. With the
default configuration for replication, the original node is destroyed
and new clones are created. By changing the "pooling" attribute [1],
you can change this behaviour:
<datapath xpath='testdata:/drawer/folder[1]/page/@id' pooling='true'/>
Regards,
André
[1]
http://www.openlaszlo.org/lps-latest/docs/reference/lz.datapath.html#LzDatapath.__ivars__.pooling
Hello,
Normally, when I add a child to a DataElement, I get one ondata call for
each DataElement added. However, when I add a DataElement to a parent
that
already has one Child (and only one child), two ondata calls are
fired. One
for each child. When there are 0, 2, 3... child elements, this does not
occur. Is this a bug or a feature? I was unable to find reference in
the bug
tracker.
Below is code illustrating the phenomenon.
Regards,
David
<canvas>
<dataset name='testdata'>
<drawer>
<folder id='a' />
</drawer>
</dataset>
<view>
<simplelayout />
<view>
<simplelayout />
<button>
Add page to folder
<datapointer name='dp' xpath='testdata:/drawer/folder[1]' />
<attribute name='pageid' type='string' value='1' />
<handler name='onclick'>
var page = new lz.DataElement('page', {'id': this['pageid']});
this.dp.p.appendChild(page);
newid = parseInt(this['pageid'])+1
this['pageid'] = newid.toString()
</handler>
</button>
<text>Contents of folder a</text>
<text datapath='testdata:/drawer/folder[1]/page/@id'>
<handler name='ondata'>
Debug.debug('ondata', this.datapath);
</handler>
</text>
</view>
<text>
Please note: every time a node is added, one ondata event occurs
EXCEPT when
there is one other child node, in which case two ondata events fire.
</text>
</view>
</canvas>