History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-1644
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: P1 P1
Assignee: Unassigned
Reporter: Pablo Kang
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

datalistselector fails to call setSelected() method if view was previously selected and was the only replicated view.

Created: 27/Feb/06 11:41 AM   Updated: 10/May/07 02:58 PM
Component/s: Laszlo Foundation Classes (LFC)
Affects Version/s: 3.4, 4.0.0
Fix Version/s: 4.0.2, Legals

Time Tracking:
Not Specified

Severity: Minor
Fixed in Change#: 4,605
Runtime: N/A
Fix in hand: False


 Description  « Hide
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;
    }
}


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Mamye Kratt - 10/May/07 02:58 PM
(branches 4.0 build 4954)
Fixed.