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

Name Type Optional Default Descripton
oGridData Object[][] checked The 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.
oColumnNames String[] An array containt the names of the columns in the grid.

Properties

Name Type get set Descripton
currentDataPage Number checked checked The index of the current data page.
dataPageCount Number checked The 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.
dataPageSize Number checked checked The amount of rows to show at one time from the data source.
dataSource BiDataSet / BiDataTable checked checked The 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).
firstRow BiGridRow checked Returns the first row.
headerCorner BiGridHeaderCorner checked This is the component that is shown in the upper left corner of the grid when both headers and row headers are shown.
lastRow BiGridRow checked Returns the last row.
rowHeaders BiGridRowHeaders checked The component responsible for drawing the grid row headers
rowHeadersHtml String checked Returns the HTML needed for the row headers
rows BiGridRow[] checked Returns all the rows.
selectionMode String checked checked Sets the selection mode. Allowed values are "cell" and "row".

Methods

Name Description
addRow Adds a grid row to the grid
createItemFromDataRow This method is called when using data binding. This is used to create a new BiGridRow from a BiDataRow.
dataBind If the grid has a dataSource then this binds that data source to the list.
getCellAtPoint Returns the grid cell at the given point. If no cell is found this returns null.
getRowAtPoint Returns the grid row at the given point. If no row is found this returns null.
hasRows Returns true if the grid has any rows
removeAll Removes and disposes all rows from the grid
removeRow Removes a grid row. Returns the removed row.
removeRowAt Removes the grid row at the given index. Returns the removed row.
updateRowHeadersHeight Updates the height of the row headers

Events

Name Type Bubbles Descripton
change BiEvent Fires when the selected row/cell changes
databind BiEvent Called 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

Name Type Optional Default Descripton
oChild BiGridRow The grid row child to add
oBefore BiGridRow checked If 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

Name Type Optional Default Descripton
oRow BiDataRow This 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

Name Type Optional Default Descripton
nClientX Number The left position relative to the browser window
nClientY Number The 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

Name Type Optional Default Descripton
nClientX Number The left position relative to the browser window
nClientY Number The 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

Name Type Optional Default Descripton
oChild BiGridRow The row to remove

Return Type

BiGridRow

removeRowAt

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

Syntax

object.removeRowAt
 (
 i
 )
 

Parameters

Name Type Optional Default Descripton
i Number The 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