Object | +--YAHOO.ext.grid.Grid
This class represents the primary interface of a component based grid control.
Usage:
var grid = new YAHOO.ext.grid.Grid('my-container-id', dataModel, columnModel);
// set any options
grid.render();
| Field Summary | |
Object |
allowTextSelectionPattern
A regular expression defining tagNames allowed to have text selection (Defaults to /INPUT|TEXTAREA/i) |
Boolean |
autoSizeColumns
True to automatically resize the columns to fit their content on initial render |
Boolean |
autoSizeHeaders
True to measure headers with column data when auto sizing columns |
String |
ddText
Configures the text is the drag proxy (defaults to "%0 selected row(s)"). |
Boolean |
enableDragDrop
True to enable drag and drop of rows |
Number |
maxRowsToMeasure
If autoSizeColumns is on, maxRowsToMeasure can be used to limit the number of rows measured to get a columns size - defaults to 0 (all rows). |
Number |
minColumnWidth
The minimum width a column can be resized to. |
Boolean |
stripeRows
True to stripe the rows (default is true) |
Boolean |
trackMouseOver
True to highlight rows when the mouse is over (default is false) |
| Constructor Summary | |
YAHOO.ext.grid.Grid
(<String/HTMLElement/YAHOO.ext.Element> container, <Object> dataModel, <Object> colModel, <Object> selectionModel)
|
|
| Method Summary * Parameter types in italic indicate optional parameters | |
void
|
addListener(<String> eventName, <Function> fn, <Object> scope, <boolean> override)
Adds a listener for one of the many defined grid events |
void
|
autoSize()
Causes the grid to manually recalculate it's dimensions. |
void
|
bindToField(fieldId)
Binds this grid to the field with the specified id. |
void
|
clearSelections()
Convenience method for getSelectionModel().clearSelections() - See YAHOO.ext.grid.DefaultSelectionModel.clearSelections() for more details. |
HTMLElement
|
getCellAfter(<HTMLElement> cell, <Boolean> includeHidden)
Returns the cell that comes after the specified cell - text nodes are skipped. |
HTMLElement
|
getCellBefore(<HTMLElement> cell, <Boolean> includeHidden)
Returns the cell that comes before the specified cell - text nodes are skipped. |
HTMLElement
|
getCellFromChild(<HTMLElement> childEl)
Returns the cell that contains the specified child element. |
Object
|
getColumnModel()
Returns the grid's ColumnModel. |
Object
|
getDataModel()
Returns the grid's DataModel. |
String
|
getDragDropText()
Called to get grid's drag proxy text, by default returns this.ddText. |
HTMLElement
|
getFirstCell(<HTMLElement> row, <Boolean> includeHidden)
Returns the first cell for the row - text nodes and hidden columns are skipped. |
HTMLElement
|
getHeaderFromChild(<HTMLElement> childEl)
Returns the header element that contains the specified child element. |
HTMLElement
|
getLastCell(<HTMLElement> row, <Boolean> includeHidden)
Returns the last cell for the row - text nodes and hidden columns are skipped. |
HTMLElement
|
getRow(index)
Returns the table row at the specified index |
HTMLElement
|
getRowAfter(<HTMLElement> row)
Returns the row that comes after the specified row - text nodes are skipped. |
HTMLElement
|
getRowBefore(<HTMLElement> row)
Returns the row that comes before the specified row - text nodes are skipped. |
HTMLElement
|
getRowFromChild(<HTMLElement> childEl)
Returns the row that contains the specified child element. |
HtmlElement/Array
|
getRowsById(id)
Returns the rows that have the specified id(s). |
Object
|
getSelectedRow()
Convenience method for getSelectionModel().getSelectedRows()[0] - See YAHOO.ext.grid.DefaultSelectionModel.getSelectedRows() for more details. |
Object
|
getSelectedRowId()
Convenience method for getSelectionModel().getSelectedRowIds()[0] - See YAHOO.ext.grid.DefaultSelectionModel.getSelectedRowIds() for more details. |
Object
|
getSelectedRowIds()
Convenience method for getSelectionModel().getSelectedRowIds() - See YAHOO.ext.grid.DefaultSelectionModel.getSelectedRowIds() for more details. |
Number
|
getSelectedRowIndex()
Gets the first selected row or -1 if none are selected |
Array
|
getSelectedRowIndexes()
Get the selected row indexes |
Object
|
getSelectedRows()
Convenience method for getSelectionModel().getSelectedRows() - See YAHOO.ext.grid.DefaultSelectionModel.getSelectedRows() for more details. |
Object
|
getSelectionCount()
Convenience method for getSelectionModel().getCount() - See YAHOO.ext.grid.DefaultSelectionModel.getCount() for more details. |
Object
|
getSelectionModel()
Returns the grid's SelectionModel. |
Object
|
getView()
Returns the grid's GridView object. |
Object
|
hasSelection()
Convenience method for getSelectionModel().hasSelection() - See YAHOO.ext.grid.DefaultSelectionModel.hasSelection() for more details. |
void
|
on(eventName, fn, scope, override)
Shorthand for addListener |
void
|
readField()
Causes the grid to read and select the ids from the bound field - See bindToField(). |
void
|
removeListener(eventName, fn, scope)
|
void
|
render()
Called once after all setup has been completed and the grid is ready to be rendered. |
void
|
scrollTo(<Number/HTMLElement> row)
Scrolls the grid to the specified row |
void
|
selectAll()
Convenience method for getSelectionModel().selectAll() - See YAHOO.ext.grid.DefaultSelectionModel.selectAll() for more details. |
void
|
setCellValue(value, rowIndex, colIndex)
|
void
|
startEditing(rowIndex, colIndex)
Starts editing the specified for the specified row/column |
void
|
stopEditing()
Stops any active editing |
| Field Detail |
Object allowTextSelectionPattern
/INPUT|TEXTAREA/i)
Boolean autoSizeColumns
Boolean autoSizeHeaders
String ddText
Boolean enableDragDrop
Number maxRowsToMeasure
Number minColumnWidth
Boolean stripeRows
Boolean trackMouseOver
| Constructor Detail |
YAHOO.ext.grid.Grid(<String/HTMLElement/YAHOO.ext.Element> container, <Object> dataModel, <Object> colModel, <Object> selectionModel)
container - The element into which this grid will be rendered - The container MUST have some type of size defined for the grid to fill. The container will be automatically set to position relative if it isn't already.
dataModel - The data model to bind to
colModel - The column model with info about this grid's columns
selectionModel - (optional) The selection model for this grid (defaults to DefaultSelectionModel)
| Method Detail |
void addListener(<String> eventName, <Function> fn, <Object> scope, <boolean> override)
eventName - The type of event to listen for
fn - The method the event invokes
scope - (optional) An arbitrary object that will be passed as a parameter to the handler
override - (optional) If true, the obj passed in becomes the execution scope of the listener
void autoSize()
void bindToField(fieldId)
The - id of the field to bind to
void clearSelections()
HTMLElement getCellAfter(<HTMLElement> cell, <Boolean> includeHidden)
cell -
includeHidden -
HTMLElement getCellBefore(<HTMLElement> cell, <Boolean> includeHidden)
cell -
includeHidden -
HTMLElement getCellFromChild(<HTMLElement> childEl)
childEl -
Object getColumnModel()
Object getDataModel()
String getDragDropText()
HTMLElement getFirstCell(<HTMLElement> row, <Boolean> includeHidden)
row -
includeHidden -
HTMLElement getHeaderFromChild(<HTMLElement> childEl)
childEl -
HTMLElement getLastCell(<HTMLElement> row, <Boolean> includeHidden)
row -
includeHidden -
HTMLElement getRow(index)
HTMLElement getRowAfter(<HTMLElement> row)
row -
HTMLElement getRowBefore(<HTMLElement> row)
row -
HTMLElement getRowFromChild(<HTMLElement> childEl)
childEl -
HtmlElement/Array getRowsById(id)
An - id to find or an array of ids
Object getSelectedRow()
Object getSelectedRowId()
Object getSelectedRowIds()
Number getSelectedRowIndex()
Array getSelectedRowIndexes()
Object getSelectedRows()
Object getSelectionCount()
Object getSelectionModel()
Object getView()
Object hasSelection()
void on(eventName, fn, scope, override)
void readField()
void removeListener(eventName, fn, scope)
void render()
void scrollTo(<Number/HTMLElement> row)
row - The row object or index of the row
void selectAll()
void setCellValue(value, rowIndex, colIndex)
void startEditing(rowIndex, colIndex)
void stopEditing()