BiGrid

This component is used to display a grid (table, column list). A grid can show headers for both the columns and the rows. A grid also supports selection of whole rows as well as of individual cells.

This class extends BiAbstractGrid and therefore all methods and fields available for BiAbstractGrid are also available for BiGrid .

Constructor

new BiGrid ( [ oGridData,oColumnNames ] )

Parameters

NameTypeOptionalDefaultDescripton
oGridDataObject[][]checkedThe initial data. This should be a 2-dimensional array (an array of arrays) containing the data. The items in the array are passed to the grid row and then to the grid cell.
oColumnNamesString[]An array containt the names of the columns in the grid.

Properties

NameTypegetsetDescripton
currentDataPageNumbercheckedcheckedThe index of the current data page.
dataPageCountNumbercheckedThe number of data pages that are available. This is the numbers of rows in the data set divided by the number of rows per page.
dataPageSizeNumbercheckedcheckedThe amount of rows to show at one time from the data source.
dataSourceBiDataSet / BiDataTablecheckedcheckedThe object to use as the data source. This can be a either a BiDataTable or a BiDataSet (in which case the first table is used).
firstRowBiGridRowcheckedReturns the first row.
headerCornerBiGridHeaderCornercheckedThis is the component that is shown in the upper left corner of the grid when both headers and row headers are shown.
lastRowBiGridRowcheckedReturns the last row.
rowHeadersBiGridRowHeaderscheckedThe component responsible for drawing the grid row headers
rowHeadersHtmlStringcheckedReturns the HTML needed for the row headers
rowsBiGridRow[]checkedReturns all the rows.
selectionModeStringcheckedcheckedSets the selection mode. Allowed values are "cell" and "row".

Methods

NameDescription
addRowAdds a grid row to the grid
createItemFromDataRowThis method is called when using data binding. This is used to create a new BiGridRow from a BiDataRow.
dataBindIf the grid has a dataSource then this binds that data source to the list.
getCellAtPointReturns the grid cell at the given point. If no cell is found this returns null.
getRowAtPointReturns the grid row at the given point. If no row is found this returns null.
hasRowsReturns true if the grid has any rows
removeAllRemoves and disposes all rows from the grid
removeRowRemoves a grid row. Returns the removed row.
removeRowAtRemoves the grid row at the given index. Returns the removed row.
updateRowHeadersHeightUpdates the height of the row headers

Events

NameTypeBubblesDescripton
changeBiEventFires when the selected row/cell changes
databindBiEventCalled after the component has been data bound

Static Methods

None.

Static Fields

None.

Remarks

After changing the data call updateData to redraw the body of the grid. When the columns have been changed you should call updateColumns.

Method Details

addRow

Adds a grid row to the grid

Syntax

object.addRow ( oChild [ ,oBefore ] )

Parameters

NameTypeOptionalDefaultDescripton
oChildBiGridRowThe grid row child to add
oBeforeBiGridRowcheckedIf provided, the child is added before this row

Return Type

void

createItemFromDataRow

This method is called when using data binding. This is used to create a new BiGridRow from a BiDataRow.

Syntax

object.createItemFromDataRow ( oRow )

Parameters

NameTypeOptionalDefaultDescripton
oRowBiDataRowThis is the row to create a new BiGridRow from.

Return Type

BiGridRow

dataBind

If the grid has a dataSource then this binds that data source to the list.

Syntax

object.dataBind ( )

Parameters

No arguments.

Return Type

void

getCellAtPoint

Returns the grid cell at the given point. If no cell is found this returns null.

Syntax

object.getCellAtPoint ( nClientX,nClientY )

Parameters

NameTypeOptionalDefaultDescripton
nClientXNumberThe left position relative to the browser window
nClientYNumberThe top position relative to the browser window

Return Type

BiGridCell

getRowAtPoint

Returns the grid row at the given point. If no row is found this returns null.

Syntax

object.getRowAtPoint ( nClientX,nClientY )

Parameters

NameTypeOptionalDefaultDescripton
nClientXNumberThe left position relative to the browser window
nClientYNumberThe top position relative to the browser window

Return Type

BiGridRow

hasRows

Returns true if the grid has any rows

Syntax

object.hasRows ( )

Parameters

No arguments.

Return Type

Boolean

removeAll

Removes and disposes all rows from the grid

Syntax

object.removeAll ( )

Parameters

No arguments.

Return Type

void

removeRow

Removes a grid row. Returns the removed row.

Syntax

object.removeRow ( oChild )

Parameters

NameTypeOptionalDefaultDescripton
oChildBiGridRowThe row to remove

Return Type

BiGridRow

removeRowAt

Removes the grid row at the given index. Returns the removed row.

Syntax

object.removeRowAt ( i )

Parameters

NameTypeOptionalDefaultDescripton
iNumberThe index of the row to remove

Return Type

BiGridRow

updateRowHeadersHeight

Updates the height of the row headers

Syntax

object.updateRowHeadersHeight ( )

Parameters

No arguments.

Return Type

void