<list>

contains listitems and provides selection capabilities.

JavaScript: list

Extends Baselist

The <list> tag creates a list which may contain <listitem>s. Subclasses of listitem, such as textlistitem, may be used as well. <list> provides basic layout and a selection API . If there are more items than specified in the shownitems attribute, a scrollbar will be provided.

<canvas width="200" height="100">
  <list x="10" y="10">
    <textlistitem text="item 1" value="1" selected="true"/>
    <textlistitem text="item 2" value="2"/>
    <textlistitem text="item 3" value="3"/>
  </list>
</canvas>

Optimizing performance with lazy replication and data pooling

When you have more items on your list than appear to the user, or if you are creating a list from data and then changing the data that is represented by the list, you should use "lazy replication" and data pooling, respectively, to optimize performance of your lists. See Performance Tuning for a discussion.

See the list_example.lzx for more list use cases.

Attributes
Name Usage Type (Tag) Type (JS) Default Category
autoscrollbar Tag & JS expression any true setter
 

If true, a scrollbar will show up automatically when there are more items than shownitems.


border_bottom Tag & JS expression any   setter
 

The size of the bottom border which defaults to bordersize.


border_left Tag & JS expression any   setter
 

The size of the left border which defaults to bordersize.


border_right Tag & JS expression any   setter
 

The size of the right border which defaults to bordersize.


border_top Tag & JS expression any   setter
 

The size of the top border which defaults to bordersize.


bordersize Tag & JS expression any 1 setter
 

The size in pixels for this list.


minheight Tag & JS number Number 24 setter
 

minumum height of the list, default: 24


scrollable Tag & JS expression any false readonly

scrollbarclassname Tag & JS string String vscrollbar setter
 

The name of the class to instantiate as our scrollbar.


shownitems Tag & JS expression any -1 setter
 

The number of items that are displayed. This value will ignored if this view attempts to draw past the canvas boundary.


spacing Tag & JS expression any 0 setter
 

The number of pixels that items should be spaced from one another.


tracking Tag & JS expression any false setter
 

Toggles the mousedown tracking.



Attributes inherited from Basecomponent

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

Attributes inherited from Baseformitem

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

Attributes inherited from Baselist

dataoption, defaultselection, itemclassname, multiselect, toggleselected

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

addItem()
list.addItem(txt, val)

Add the specified item to the end of the list.

Parameters
Name Type Desc
txt String the text for the item.
val Object the value for the item.


ensureItemInView()
list.ensureItemInView(item)

If the item is not in view, the list is auto-scrolled so that the specified item appears at the top of the list.

Parameters
Name Type Desc
item None


select()
list.select(v)

Select an item. Scrolls list so that it appears, if not in view.

Parameters
Name Type Desc
v LzView the view to select (may be an array, when multiselect == true)


Methods inherited from basecomponent

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

Methods inherited from baseformitem

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

Methods inherited from baselist

addItem, clearSelection, getItem, getItemAt, getNumItems, getSelection, getText, getValue, moveSelection, removeItem, removeItemAt, select, selectItem, selectItemAt, selectNext, selectPrev, setHilite

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