Author: max
Date: 2007-09-04 14:57:24 -0700 (Tue, 04 Sep 2007)
New Revision: 6344
Modified:
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicator.lzx
openlaszlo/branches/wafflecone/test/explicit-replicators/replicator.lzx
Log:
Change 20070904-maxcarlson-N by [EMAIL PROTECTED] on 2007-09-04 13:51:25 PDT
in /Users/maxcarlson/openlaszlo/wafflecone
for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone
Summary: Update explicit replicator when items are added or deleted
New Features:
Bugs Fixed: LPP-4612 - Explicit replicator doesn't update when items are added
or deleted
Technical Reviewer: pkang
QA Reviewer: ptw
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: test/explicit-replicators/replicator.lzx - Incorporate tests from
LPP-4612.
lps/components/utils/replicator/replicator.lzx - Store reference to dataset
pointer. Register _updateChildren() for onDocumentChange events. Add
_updateChildren() method to receive document change events and rerun the xpath.
Tests: See LPP-4612. Also updated test/explicit-replicators/replicator.lzx.
Modified:
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicator.lzx
===================================================================
---
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicator.lzx
2007-09-04 21:45:17 UTC (rev 6343)
+++
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicator.lzx
2007-09-04 21:57:24 UTC (rev 6344)
@@ -136,10 +136,17 @@
function init() {
super.init.apply(this, arguments);
if (this.dataset && this.xpath) {
- this.setNodes(this.dataset.getPointer().xpathQuery(this.xpath))
+ this._pointer = this.dataset.getPointer();
+ this._ondatadel = new LzDelegate(this, '_updateChildren',
this._pointer.p, 'onDocumentChange')
+ this._updateChildren();
}
}
+ // @keywords private
+ function _updateChildren(c) {
+ // TODO: use changepackage to do something smarter here
+ this.setNodes(this._pointer.xpathQuery(this.xpath))
+ }
// @keywords private
function createChildren (c) {
Modified:
openlaszlo/branches/wafflecone/test/explicit-replicators/replicator.lzx
===================================================================
--- openlaszlo/branches/wafflecone/test/explicit-replicators/replicator.lzx
2007-09-04 21:45:17 UTC (rev 6343)
+++ openlaszlo/branches/wafflecone/test/explicit-replicators/replicator.lzx
2007-09-04 21:57:24 UTC (rev 6344)
@@ -8,12 +8,23 @@
<product name="pumpkin" color="orange"/>
</dataset>
+ <simplelayout/>
+
+ <button text="add new item">
+ <handler name="onclick">
+ mydata.appendChild(new LzDataElement("product", { name: "NEW ITEM",
color: 'purple'}));
+ </handler>
+ </button>
+
<view name="bar">
<simplelayout axis="y" spacing="2" />
<replicator name="foo"
dataset="mydata"
xpath="'/product/'">
<view bgcolor="red" height="23">
+ <handler name="onclick">
+ this.data.parentNode.removeChild(this.data);
+ </handler>
<simplelayout axis="x" />
<text datapath="@name"
width="75"
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins