basedatacombobox_item.lzx

<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2005-2008 Laszlo Systems, Inc. All Rights Reserved.               *
* Use is subject to license terms.                                            *
* X_LZ_COPYRIGHT_END ****************************************************** -->
<!-- @LZX_VERSION@                                                         -->
<library>
    <include href="lz/textlistitem.lzx"/>

    <!--- Class used to create an item in a basedatacombobox's list.
          @keywords private -->
    <class name="basedatacombobox_item" extends="textlistitem" width="${null}">
        <!--- @keywords private -->
        <handler name="onmousedown">
            this.parent.select(this);
        </handler>
        
        <!--- Also called by the combobox when it opens if the data
             might have changed.
            @keywords private -->
        <handler name="ondata" method="handleData"/> 
        <method name="handleData" args="d">
            var target = this.parent.attachtarget;
            var t = this.datapath.xpathQuery(target.textdatapath);
            var v = this.datapath.xpathQuery(target.valuedatapath);
            if ($debug) {
                if (typeof t == "undefined") {
                    Debug.warn("basedatacombobox_item textdatapath result is undefined");
                }
                if (typeof v == "undefined") {
                    Debug.warn("basedatacombobox_item valuedatapath result is undefined");
                }
            }
            this.setAttribute('text', ( t == void(0) ? '' : t ));
            this.setAttribute('value', ( v == void(0) ? null : v ));
            
            // special case for separator string
            // TODO [2005-4-01, dchung] could this be rendered as a line?
            this.setAttribute('enabled', (t != '-----'));

            this.setAttribute("width", target.listwidth ? target.listwidth : target.width);
        </method>
    </class>
</library>

Cross References

Includes

Classes