
| Key: |
LPP-1644
|
| Type: |
Bug
|
| Status: |
Closed
|
| Resolution: |
Fixed
|
| Priority: |
P1
|
| Assignee: |
Unassigned
|
| Reporter: |
Pablo Kang
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
| Severity: |
Minor
|
| Fixed in Change#: |
4,605
|
| Runtime: |
N/A
|
| Fix in hand: |
False
|
|
Test case:
<canvas>
<!--
1. click on the "select first item" button.
2. click on the "replicate" button.
3. click on the "select first item" button.
Note that the second view appears in red (or the selected color) when it
should be yellow.
-->
<include href="base/datalistselector.lzx"/>
<dataset name="dset">
<item text="one" />
</dataset>
<simplelayout axis="x" spacing="20" />
<view id="container" layout="spacing: 5">
<datalistselector name="selector" />
<view datapath="dset:/item" bgcolor="yellow">
<text datapath="@text" resize="true" />
<method name="setSelected" args="s">
Debug.write('setSelected', s, this);
this.setBGColor(s?red:yellow);
</method>
</view>
</view>
<button text="select first item"
onclick="container.selector.select(container.subviews[0])" />
<button text="replicate">
<handler name="onclick">
var cnodes = dset.childNodes;
cnodes.splice(0,0, new LzDataElement('item', { text: 'two' }));
dset.setChildNodes(cnodes);
</handler>
</button>
</canvas>
The problem is in LzDataSelectionManager.__LZsetSelected, where this.manager is not going to exist when a databound view replicates only on one item:
LzDataSelectionManager.prototype.__LZsetSelected = function ( p, val ){
var cl = this.manager.getCloneForNode( p, true ); // <-- this.manager can be null
if (cl) {
cl.datapath[this.sel](val);
} else { // no clone on screen
p.sel = val;
}
}
|
|
Description
|
Test case:
<canvas>
<!--
1. click on the "select first item" button.
2. click on the "replicate" button.
3. click on the "select first item" button.
Note that the second view appears in red (or the selected color) when it
should be yellow.
-->
<include href="base/datalistselector.lzx"/>
<dataset name="dset">
<item text="one" />
</dataset>
<simplelayout axis="x" spacing="20" />
<view id="container" layout="spacing: 5">
<datalistselector name="selector" />
<view datapath="dset:/item" bgcolor="yellow">
<text datapath="@text" resize="true" />
<method name="setSelected" args="s">
Debug.write('setSelected', s, this);
this.setBGColor(s?red:yellow);
</method>
</view>
</view>
<button text="select first item"
onclick="container.selector.select(container.subviews[0])" />
<button text="replicate">
<handler name="onclick">
var cnodes = dset.childNodes;
cnodes.splice(0,0, new LzDataElement('item', { text: 'two' }));
dset.setChildNodes(cnodes);
</handler>
</button>
</canvas>
The problem is in LzDataSelectionManager.__LZsetSelected, where this.manager is not going to exist when a databound view replicates only on one item:
LzDataSelectionManager.prototype.__LZsetSelected = function ( p, val ){
var cl = this.manager.getCloneForNode( p, true ); // <-- this.manager can be null
if (cl) {
cl.datapath[this.sel](val);
} else { // no clone on screen
p.sel = val;
}
}
|
Show » |
|
Fixed.