Jx.Grid.Model

Extends: Object

Implements: Options, Events

A Jx.Grid.Model is the source of data for a Jx.Grid instance.  The default implementation of the grid model works with two-dimensional arrays of data and acts as a convenient base class for custom models based on other sources of data.

License

Copyright © 2008, DM Solutions Group Inc.

This file is licensed under an MIT style license

Summary
Jx.Grid.ModelExtends: Object
Options
colHeaderHeightdefault 28, the height of the column header row
colHeaderHeightdefault 28, the height of the column header row
rowHeaderWidthdefault 28, the width of the row header column.
colWidthdefault 50, the width of columns
rowHeightdefault 20, the height of rows
columnHeadersoptional column headers, defaults to null
Constructor
Jx.Grid.Modelcreate a new grid model
Functions
getColumnCountThis function returns the number of columns of data in the model as an integer value.
getColumnHeaderHTMLThis function returns an HTML string to be placed in the column header for the given column index.
getColumnHeaderHeightThis function returns an integer which is the height of the column header row in pixels.
getColumnWidthThis function returns an integer which is the width of the given column in pixels.
getRowHeaderHTMLThis function returns an HTML string to be placed in the row header for the given row index
getRowHeaderWidthThis function returns an integer which is the width of the row header column in pixels.
getRowHeightThis function returns an integer which is the height of the given row in pixels.
getRowCountThis function returns the number of rows of data in the model as an integer value.
getValueAtThis function returns an HTML string which is the text to place in the cell at the given row and column.
setColumnWidthThis function is called with a column index and width in pixels when a column is resized.
isCellEditableThis function returns a boolean value to indicate if a given cell is editable by the user.
setValueAtThis function is called with the row and column of a cell and a new value for the cell.
rowSelectedThis function is called by the grid to indicate that the user has selected a row by clicking on the row header.
columnSelectedThis function is called by the grid to indicate that the user has selected a column by clicking on the column header.
cellSelectedThis function is called by the grid to indicate that the user has selected a cell by clicking on the cell in the grid.

Options

colHeaderHeight

default 28, the height of the column header row

colHeaderHeight

default 28, the height of the column header row

rowHeaderWidth

default 28, the width of the row header column.

colWidth

default 50, the width of columns

rowHeight

default 20, the height of rows

columnHeaders

optional column headers, defaults to null

Constructor

Jx.Grid.Model

create a new grid model

Parameters

dataarray of data to display in the grid
optionsJx.Grid.Model.Options

Functions

getColumnCount

getColumnCount: function()

This function returns the number of columns of data in the model as an integer value.

getColumnHeaderHTML

getColumnHeaderHTML: function(col)

This function returns an HTML string to be placed in the column header for the given column index.

getColumnHeaderHeight

getColumnHeaderHeight: function()

This function returns an integer which is the height of the column header row in pixels.

getColumnWidth

getColumnWidth: function(col)

This function returns an integer which is the width of the given column in pixels.

getRowHeaderHTML

getRowHeaderHTML: function(row)

This function returns an HTML string to be placed in the row header for the given row index

getRowHeaderWidth

getRowHeaderWidth: function()

This function returns an integer which is the width of the row header column in pixels.

getRowHeight

getRowHeight: function(row)

This function returns an integer which is the height of the given row in pixels.

getRowCount

getRowCount: function()

This function returns the number of rows of data in the model as an integer value.

getValueAt

getValueAt: function(row,
col)

This function returns an HTML string which is the text to place in the cell at the given row and column.

setColumnWidth

setColumnWidth: function()

This function is called with a column index and width in pixels when a column is resized.  This function is only required if the grid allows resizeable columns.

isCellEditable

isCellEditable: function()

This function returns a boolean value to indicate if a given cell is editable by the user.

setValueAt

setValueAt: function(row,
col,
value)

This function is called with the row and column of a cell and a new value for the cell.  It is mandatory to provide this function if any of the cells in the model are editable.

rowSelected

rowSelected: function(grid,
row)

This function is called by the grid to indicate that the user has selected a row by clicking on the row header.

columnSelected

columnSelected: function(grid,
col)

This function is called by the grid to indicate that the user has selected a column by clicking on the column header.

cellSelected

cellSelected: function(grid,
row,
col)

This function is called by the grid to indicate that the user has selected a cell by clicking on the cell in the grid.

getColumnCount: function()
This function returns the number of columns of data in the model as an integer value.
getColumnHeaderHTML: function(col)
This function returns an HTML string to be placed in the column header for the given column index.
getColumnHeaderHeight: function()
This function returns an integer which is the height of the column header row in pixels.
getColumnWidth: function(col)
This function returns an integer which is the width of the given column in pixels.
getRowHeaderHTML: function(row)
This function returns an HTML string to be placed in the row header for the given row index
getRowHeaderWidth: function()
This function returns an integer which is the width of the row header column in pixels.
getRowHeight: function(row)
This function returns an integer which is the height of the given row in pixels.
getRowCount: function()
This function returns the number of rows of data in the model as an integer value.
getValueAt: function(row,
col)
This function returns an HTML string which is the text to place in the cell at the given row and column.
setColumnWidth: function()
This function is called with a column index and width in pixels when a column is resized.
isCellEditable: function()
This function returns a boolean value to indicate if a given cell is editable by the user.
setValueAt: function(row,
col,
value)
This function is called with the row and column of a cell and a new value for the cell.
rowSelected: function(grid,
row)
This function is called by the grid to indicate that the user has selected a row by clicking on the row header.
columnSelected: function(grid,
col)
This function is called by the grid to indicate that the user has selected a column by clicking on the column header.
cellSelected: function(grid,
row,
col)
This function is called by the grid to indicate that the user has selected a cell by clicking on the cell in the grid.
Extends: Object