<basegrid>

An abstract row-based container for data elements.

JavaScript: basegrid

Extends Basecomponent

basegrid is an abstract container for row-based data stored in a dataset. Because basegrid uses lazy replication, it is an efficient way to present large datasets, and it abstracts some of the complications involved in maintaining a selection within a dataset.

<canvas height="150">
  <dataset name="contacts" request="true"
      src="http:resources/contactsdata.xml"/>

  <basegrid datapath="contacts:/resultset" width="200"
               height="150">
    <basegridcolumn>
      <text placement="header">Check 'em off</text>
      <checkbox text="$path{ '@displayname'}" 
                value="$path{'@checked'}">
        <handler name="onvalue">
          this.parent.parent.datapath.updateData();
        </handler>
      </checkbox>
    </basegridcolumn>
    <scrollbar placement="content"/>
  </basegrid>
</canvas>
Attributes
Name Usage Type (Tag) Type (JS) Default Category
bgcolor0 Tag & JS color Number   setter
 

If given, sets the bgcolor for even numbered rows. If not given, the bgcolor for these rows is taken from the style's bgcolor.


bgcolor1 Tag & JS color Number   setter
 

If given, sets the bgcolor for odd numbered rows. If not given, the bgcolor for these rows is taken from the style's bgcolor.


columns Tag & JS expression any null setter
 

An array holding the basegridcolumns used by this grid


contentdatapath Tag & JS string String * setter
 

The datapath to use for the contents of the grid. By default, this is set to "*", meaning all of the nodes underneath the datacontext of the grid.


hilite Tag & JS expression any null setter
 

The view which is currently hilited.


multiselect Tag & JS expression any true setter
 

If true, the list will allow for multiple selection, and the getSelection method will always return a list. If false, only single selection is allowed.


rowheight Tag & JS number Number null setter
 

Optional height for the rows contained by the grid. If no value is given for this attribute, it will be set to the calculated height of rows.


selectable Tag & JS expression any true setter
 

If false, the rows are not clickable and the grid does not support selection.


showhlines Tag & JS boolean Boolean false setter
 

If true, lines will be drawn (in component's style's bordercolor) vertically at each at each column division. This attribute can be set after instantiation.


shownitems Tag & JS expression any -1 setter
 

Sets the height of the grid to show a maximum of 'n' items.


showvlines Tag & JS boolean Boolean false setter
 

If true, lines will be drawn (in component's style's bordercolor) horizontally at each at each row division. This attribute cannot be set after instantiation.


sizetoheader Tag & JS expression any null setter
 

A boolean. If true, the grid will keep its width set to the size of the header. This is automatically set to true for grids that do not have a set width. This is initially set to 0, which means that it is not true, but if it is explicitly set to false, the automatic behavior will be disabled for grids with no set width.


spacing Tag & JS number Number 0 setter
 

Spacing between the rows.



Attributes inherited from Basecomponent

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

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

clearSelection()
basegrid.clearSelection()

Clear the current selection.



clearSort()
basegrid.clearSort()

Removes the current sort if one is set, and restores the original order of the dataset.



getIndexForItem()
basegrid.getIndexForItem(item)

Get the index for an item.

Parameters
Name Type Desc
item basegridrow the item for which to find the index
Returns
Type Desc
Number index the index for the item.


getItem()
basegrid.getItem(data)

Find a particular item by its data node.

Parameters
Name Type Desc
data LzDatanode the data for the item to get.
Returns
Type Desc
basegridrow item the item found, or null, if not.


getItemAt()
basegrid.getItemAt(index)

Get a particular item by its index.

Parameters
Name Type Desc
index Number the index for the item to get.
Returns
Type Desc
basegridrow the item found, or null, if not.


getNumItems()
basegrid.getNumItems()

Get the number of items in the list.

Returns
Type Desc
Number number of items.


getSelection()
basegrid.getSelection()

Get the selection for the list.

Returns
Type Desc
Object null if no selection, an LzDatapointer if single select (default), or an array of LzDatapointers if multiselect.


removeItemAt()
basegrid.removeItemAt(index)

Find the item at the specified index and remove it from the list.

Parameters
Name Type Desc
index Number the index of the item to remove.


select()
basegrid.select(item)

Select an item.

Parameters
Name Type Desc
item basegridrow the basegridrow to select (may be an array when multiselect == true)


selectItem()
basegrid.selectItem(data)

Select an item by its datanode.

Parameters
Name Type Desc
data LzDatanode the data of the item to select.


selectItemAt()
basegrid.selectItemAt(index)

Select an item by index.

Parameters
Name Type Desc
index Number the index of the item to select.


selectNext()
basegrid.selectNext()

Move the selection to the next view.



selectPrev()
basegrid.selectPrev()

Move the selection to the previous view.



Methods inherited from basecomponent

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

Methods inherited from LzNode

animate, applyConstraint, applyData, 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, init, 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