Class YAHOO.ext.grid.DefaultDataModel

Object
   |
   +--YAHOO.ext.grid.AbstractDataModel
         |
         +--YAHOO.ext.grid.DefaultDataModel
Direct Known Subclasses:
YAHOO.ext.grid.LoadableDataModel

class YAHOO.ext.grid.DefaultDataModel
extends YAHOO.ext.grid.AbstractDataModel


This is the default implementation of a DataModel used by the Grid. It works with multi-dimensional array based data. Using the event system in the base class YAHOO.ext.grid.AbstractDataModel, all updates to this DataModel are automatically reflected in the user interface.
Usage:


 var myData = [
	["MSFT","Microsoft Corporation", "314,571.156", "32,187.000", "55000"],
	["ORCL", "Oracle Corporation", "62,615.266", "9,519.000", "40650"]
 ];
 var dataModel = new YAHOO.ext.grid.DefaultDataModel(myData);
 

Defined in DefaultDataModel.js


 
Fields inherited from class YAHOO.ext.grid.AbstractDataModel
onCellUpdated, onTableDataChanged, onRowsDeleted, onRowsInserted, onRowsUpdated, onRowsSorted, events, addListener, removeListener, fireEvent
 
Constructor Summary
YAHOO.ext.grid.DefaultDataModel (data)
  
 
Method Summary * Parameter types in italic indicate optional parameters
 Number addRow(<Array> cellValues)
   Adds a row to the dataset.
 void applySort(suppressEvent)
   Applies the last used sort to the current data.
 Number filter(<Object> query)
   Filter the DataModel rows by the query defined in spec, see query() for more details on the query spec.
 Array getRow(rowIndex)
   Returns the column data for the specified row.
 Number getRowCount()
   Returns the number of rows in the dataset
 Number getRowId(rowIndex)
   Returns the ID of the specified row.
 Array getRows(<Array> indexes)
   Returns the column data for the specified rows as a multi-dimensional array: rows[3][0] would give you the value of row 4, column 0.
 Object getValueAt(<Number> rowIndex, <Number> colIndex)
   Returns the value at the specified data position
 Number insertRow(<Number> index, <Array> cellValues)
   Inserts a row a the specified location in the dataset.
 Array query(<Object> spec, <Boolean> returnUnmatched)
   Query the DataModel rows by the filters defined in spec, for example...
 void removeRow(<Number> index)
   Remove a row.
 void setDefaultSort(columnModel, columnIndex, direction)
  
 void setValueAt(<Object> value, <Number> rowIndex, <Number> colIndex)
   Sets the specified value at the specified data position
 void sort(<YAHOO.ext.grid.DefaultColumnModel> columnModel, <Number> columnIndex, <String> direction, suppressEvent)
   Sorts the data by the specified column - Uses the sortType specified for the column in the passed columnModel.
 
Methods inherited from class YAHOO.ext.grid.AbstractDataModel
fireCellUpdated, fireTableDataChanged, fireRowsDeleted, fireRowsInserted, fireRowsUpdated, fireRowsSorted, getSortState, getTotalRowCount, isPaged
 

Constructor Detail

YAHOO.ext.grid.DefaultDataModel

YAHOO.ext.grid.DefaultDataModel(data)

Method Detail

addRow

Number addRow(<Array> cellValues)

applySort

void applySort(suppressEvent)

filter

Number filter(<Object> query)

getRow

Array getRow(rowIndex)

getRowCount

Number getRowCount()

getRowId

Number getRowId(rowIndex)

getRows

Array getRows(<Array> indexes)

getValueAt

Object getValueAt(<Number> rowIndex, <Number> colIndex)

insertRow

Number insertRow(<Number> index, <Array> cellValues)

query

Array query(<Object> spec, <Boolean> returnUnmatched)

removeRow

void removeRow(<Number> index)

setDefaultSort

void setDefaultSort(columnModel, columnIndex, direction)

setValueAt

void setValueAt(<Object> value, <Number> rowIndex, <Number> colIndex)

sort

void sort(<YAHOO.ext.grid.DefaultColumnModel> columnModel, <Number> columnIndex, <String> direction, suppressEvent)


Documentation generated by JSDoc on Sat Oct 14 06:07:10 2006