<datacombobox>

combobox displays a data-driven dropdown list of selectable items.

JavaScript: datacombobox

Extends Basedatacombobox

A combination box or "combobox" is a common UI element for displaying a pop-up list associated with a text field.

OpenLaszlo includes two variants of the combobox:

The selected text of the combobox is displayed within the text field. This field is an LzInputText field if the editable of the combobox is true (the default), or a static LzText field if it is false.

The number of items shown in the combobox can be set using the shownitems attribute. If there are more items available than are shown, a scrollbar will be created automatically.

The list of items in a combobox can be created explicity using the <textlistitem> tag with assigned text and value attributes.

Example 1. simple datacombobox
<canvas bgcolor="#EAEAEA"  height="200">
    <include href="lz/datacombobox.lzx"/>
    
    <dataset name="items">
        <item value="item0" >item 0</item>
        <item value="item1" >item 1</item>
        <item value="item2" >item 2</item>
        <item value="item3" >item 3</item>
        <item value="item4" >item 4</item>
        <item value="item5" >item 5</item>
        <item value="item6" >item 6</item>
        <item value="item7" >item 7</item>
        <item value="item8" >item 8</item>
        <item value="item9" >item 9</item>
        <item value="item10" >item 10</item>
        <item value="item11" >item 11</item>
    </dataset>
  
    <view x="20" y="20" >
        <simplelayout/>
        <text> local data, defaulttext="choose one.." </text>
        <datacombobox id="cbox1"
                   width="130"  
                   shownitems="6"
                   defaulttext="Choose One..."
                   itemdatapath="items:/item"/>
    </view>
</canvas>
Attributes

Attributes inherited from Basecomponent

doesenter, enabled, hasdefault, isdefault, style, styleable, text

Attributes inherited from Basedatacombobox

defaulttext, ismenu, isopen, itemclassname, itemdatapath, listattach, listwidth, menuclassname, oncomboblur, oncombofocus, onisopen, onselected, selected, selectfirst, shownitems, statictext, textdatapath, valuedatapath

Attributes inherited from Baseformitem

changed, ignoreform, onchanged, onvalue, rollbackvalue, submit, submitname

Attributes inherited from Basevaluecomponent

value

Attributes inherited from Node

class, classroot, cloneManager, datapath, id, ignoreAttribute, ignoreplacement, immediateparent, initstage, name, nodeLevel, onconstruct, oninit, parent, placement, subnodes

Attributes inherited from View

aaactive, aadescription, aaname, aasilent, aatabindex, align, bgcolor, clickable, clickregion, clip, cursor, defaultplacement, fgcolor, focusable, focustrap, font, fontsize, fontstyle, frame, framesloadratio, hassetheight, hassetwidth, height, layout, loadratio, mask, onblur, onclick, ondata, ondblclick, onfocus, onkeydown, onkeyup, onmousedown, onmouseout, onmouseover, onmouseup, onselect, opacity, options, pixellock, play, resource, resourceheight, resourcewidth, rotation, selectiontype, showhandcursor, source, stretches, subviews, totalframes, unstretchedheight, unstretchedwidth, valign, visible, width, x, xoffset, y, yoffset


Methods

Methods inherited from basecomponent

doEnterDown, doEnterUp, doSpaceDown, doSpaceUp, setStyle, setTint, updateDefault

Methods inherited from basedatacombobox

getItemIndex, getValue, selectItem, selectItemAt, setChanged, setOpen, setValue, toggle

Methods inherited from baseformitem

applyData, commit, findForm, init, rollback, toXML, updateData

Methods inherited from LzNode

animate, applyConstraint, childOf, completeInstantiation, createChildren, dataBindAttribute, destroy, determinePlacement, getAttribute, getOption, getUID, lookupSourceLocator, searchImmediateSubnodes, searchSubnodes, setAttribute, setDatapath, setID, setName, setOption

Methods inherited from LzView

addProxyPolicy, addSubview, bringToFront, construct, containsPt, getAttributeRelative, getBounds, getColor, getColorTransform, getContextMenu, getCurrentTime, getDepthList, getHeight, getID3, getMouse, getPan, getTotalTime, getVolume, getWidth, measureHeight, measureWidth, play, releaseLayouts, removeProxyPolicy, searchParents, searchSubviews, seek, sendBehind, sendInFrontOf, sendToBack, setAAActive, setAADescription, setAAName, setAASilent, setAATabIndex, setAlign, setAttributeRelative, setBGColor, setClickable, setColor, setColorTransform, setContextMenu, setCursor, setHeight, setLayout, setOpacity, setPan, setPlay, setResource, setResourceNumber, setRotation, setShowHandCursor, setSource, setValign, setVisible, setVolume, setWidth, setX, setY, shouldYieldFocus, stop, stretchResource, unload, updateResourceSize


Events

Events inherited from LzNode

onconstruct, ondata, oninit

Events inherited from LzView

onaddsubresource, onaddsubview, onblur, onclick, ondblclick, onerror, onfocus, onframe, onheight, onlastframe, onload, onmousedown, onmousedragin, onmousedragout, onmouseout, onmouseover, onmouseup, onmouseupoutside, onopacity, onplay, onremovesubview, onstop, ontimeout, onwidth, onx, ony