Name

basegrid — An abstract row-based container for data elements.

Synopsis

LZX: basegrid
JavaScript: basegrid
Type: Class
Access: public
Topic: Components.Base Components
Declared in: lps/components/base/basegrid.lzx

Description

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>
            
An abstract container for data rows, relying on lazy replication to make it possible to display large datasets.

Superclass Chain

node (LzNode) » view (LzView) » basecomponent » basegrid

Known Subclasses

Known Direct Subclasses: grid

Details

Properties (15)

bgcolor0
<attribute name="bgcolor0" type="color" value="$immediately{null}" />
public var bgcolor0 : color;
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
<attribute name="bgcolor1" type="color" value="$immediately{null}" />
public var bgcolor1 : color;
If given, sets the bgcolor for odd numbered rows. If not given, the bgcolor for these rows is taken from the style's bgcolor.
_columnclass
<attribute name="_columnclass" value="basegridcolumn" />
protected var _columnclass;
The class to use to construct columns, if the columns are inferred by the basegrid.
columns
<attribute name="columns" value="null" />
public var columns;
An array holding the basegridcolumns used by this grid
contentdatapath
<attribute name="contentdatapath" type="string" value="*" />
public var contentdatapath : String;
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
<attribute name="hilite" value="null" />
public var hilite;
The view which is currently hilited.
multiselect
<attribute name="multiselect" value="true" />
public var multiselect;
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.
_rowclass
<attribute name="_rowclass" value="basegridrow" />
protected var _rowclass;
The class to use to construct rows.
rowheight
<attribute name="rowheight" type="number" value="null" />
public var rowheight : Number;
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
<attribute name="selectable" value="true" />
public var selectable;
If false, the rows are not clickable and the grid does not support selection.
showhlines
<attribute name="showhlines" type="boolean" value="false" />
public var showhlines : Boolean;
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
<attribute name="shownitems" value="-1" />
public var shownitems;
Sets the height of the grid to show a maximum of 'n' items.
showvlines
<attribute name="showvlines" type="boolean" value="false" />
public var showvlines : Boolean;
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
<attribute name="sizetoheader" type="expression" value="null" />
public var sizetoheader : Object;
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
<attribute name="spacing" type="number" value="0" />
public var spacing : Number;
Spacing between the rows.

Methods (13)

clearSelection()
<method name="clearSelection" />
public function clearSelection();
Clear the current selection.
clearSort()
<method name="clearSort" />
public function clearSort();
Removes the current sort if one is set, and restores the original order of the dataset.
getIndexForItem()
<method name="getIndexForItem" args="item" />
public function getIndexForItem(item : basegridrow);
Get the index for an item.
getItem()
<method name="getItem" args="data" />
public function getItem(data : LzDatanode);
Find a particular item by its data node.
getItemAt()
<method name="getItemAt" args="index" />
public function getItemAt(index : Number) : basegridrow;
Get a particular item by its index.
getNumItems()
<method name="getNumItems" />
public function getNumItems() : Number;
Get the number of items in the list.
getSelection()
<method name="getSelection" />
public function getSelection() : Object;
Get the selection for the list.
removeItemAt()
<method name="removeItemAt" args="index" />
public function removeItemAt(index : Number);
Find the item at the specified index and remove it from the list.
select()
<method name="select" args="item" />
public function select(item : basegridrow);
Select an item.
selectItem()
<method name="selectItem" args="data" />
public function selectItem(data : LzDatanode);
Select an item by its datanode.
selectItemAt()
<method name="selectItemAt" args="index" />
public function selectItemAt(index : Number);
Select an item by index.
selectNext()
<method name="selectNext" />
public function selectNext();
Move the selection to the next view.
selectPrev()
<method name="selectPrev" />
public function selectPrev();
Move the selection to the previous view.

Events (1)

onselect
<attribute name="onselect" />
public event onselect;
Event sent when the grid selection changes.

LZX Synopsis

<class name="basegrid" extends=" basecomponent ">
  <attribute name=" bgcolor0 " type="color" value="$immediately{null}" />
  <attribute name=" bgcolor1 " type="color" value="$immediately{null}" />
  <attribute name=" _columnclass " value="basegridcolumn" />
  <attribute name=" columns " value="null" />
  <attribute name=" contentdatapath " type="string" value="*" />
  <attribute name=" hilite " value="null" />
  <attribute name=" multiselect " value="true" />
  <attribute name=" _rowclass " value="basegridrow" />
  <attribute name=" rowheight " type="number" value="null" />
  <attribute name=" selectable " value="true" />
  <attribute name=" showhlines " type="boolean" value="false" />
  <attribute name=" shownitems " value="-1" />
  <attribute name=" showvlines " type="boolean" value="false" />
  <attribute name=" sizetoheader " type="expression" value="null" />
  <attribute name=" spacing " type="number" value="0" />
  <method name=" clearSelection " />
  <method name=" clearSort " />
  <method name=" getIndexForItem " args="item" />
  <method name=" getItem " args="data" />
  <method name=" getItemAt " args="index" />
  <method name=" getNumItems " />
  <method name=" getSelection " />
  <event name=" onselect " />
  <method name=" removeItemAt " args="index" />
  <method name=" select " args="item" />
  <method name=" selectItem " args="data" />
  <method name=" selectItemAt " args="index" />
  <method name=" selectNext " />
  <method name=" selectPrev " />
</class>

JavaScript Synopsis

public basegrid extends  basecomponent  {
  public var bgcolor0  : color;
  public var bgcolor1  : color;
  protected var _columnclass ;
  public var columns ;
  public var contentdatapath  : String;
  public var hilite ;
  public var multiselect ;
  protected var _rowclass ;
  public var rowheight  : Number;
  public var selectable ;
  public var showhlines  : Boolean;
  public var shownitems ;
  public var showvlines  : Boolean;
  public var sizetoheader  : Object;
  public var spacing  : Number;
  prototype public function clearSelection ();
  prototype public function clearSort ();
  prototype public function getIndexForItem (item : basegridrow);
  prototype public function getItem (data : LzDatanode);
  prototype public function getItemAt (index : Number) : basegridrow;
  prototype public function getNumItems () : Number;
  prototype public function getSelection () : Object;
  prototype public event onselect ;
  prototype public function removeItemAt (index : Number);
  prototype public function select (item : basegridrow);
  prototype public function selectItem (data : LzDatanode);
  prototype public function selectItemAt (index : Number);
  prototype public function selectNext ();
  prototype public function selectPrev ();
}