Object
|
+--YAHOO.ext.grid.AbstractColumnModel
|
+--YAHOO.ext.grid.DefaultColumnModel
This is the default implementation of a ColumnModel used by the Grid. It defines
the columns in the grid.
Usage:
var sort = YAHOO.ext.grid.DefaultColumnModel.sortTypes;
var myColumns = [
{header: "Ticker", width: 60, sortable: true, sortType: sort.asUCString},
{header: "Company Name", width: 150, sortable: true, sortType: sort.asUCString},
{header: "Market Cap.", width: 100, sortable: true, sortType: sort.asFloat},
{header: "$ Sales", width: 100, sortable: true, sortType: sort.asFloat, renderer: money},
{header: "Employees", width: 100, sortable: true, sortType: sort.asFloat}
];
var colModel = new YAHOO.ext.grid.DefaultColumnModel(myColumns);
| Field Summary | |
Object |
config
The config passed into the constructor |
Boolean |
defaultSortable
Default sortable of columns which have no sortable specified (defaults to false) |
Number |
defaultWidth
The width of columns which have no width specified (defaults to 100) |
<static> Object |
sortTypes
Defines the default sorting (casting?) comparison functions used when sorting data: sortTypes.none - sorts data as it is without casting or parsing (the default) sortTypes.asUCString - case insensitive string sortTypes.asDate - attempts to parse data as a date sortTypes.asFloat sortTypes.asInt |
| Fields inherited from class YAHOO.ext.grid.AbstractColumnModel |
onWidthChange, onHeaderChange, onHiddenChange
|
| Constructor Summary | |
YAHOO.ext.grid.DefaultColumnModel
(config)
|
|
| Method Summary * Parameter types in italic indicate optional parameters | |
Object
|
getCellEditor(<Number> colIndex, <Number> rowIndex)
Returns the editor defined for the cell/column. |
Number
|
getColumnCount()
Returns the number of columns. |
String
|
getColumnHeader(<Number> col)
Returns the header for the specified column. |
Number
|
getColumnWidth(<Number> col)
Returns the width for the specified column. |
Number
|
getDataIndex(<Number> col)
Returns the dataIndex for the specified column. |
Function
|
getRenderer(<Number> col)
Returns the rendering (formatting) function defined for the column. |
Function
|
getSortType(<Number> col)
Returns the sorting comparison function defined for the column (defaults to sortTypes.none). |
Number
|
getTotalWidth(<Boolean> includeHidden)
Returns the total width of all columns. |
Boolean
|
isCellEditable(<Number> colIndex, <Number> rowIndex)
Returns true if the cell is editable. |
Boolean
|
isHidden(<Number> colIndex)
Returns true if the column is hidden. |
Boolean
|
isSortable(<Number> col)
Returns true if the specified column is sortable. |
void
|
setColumnHeader(<Number> col, <String> header)
Sets the header for a column. |
void
|
setColumnWidth(<Number> col, <Number> width, suppressEvent)
Sets the width for a column. |
void
|
setDataIndex(<Number> col, <Number> dataIndex)
Sets the dataIndex for a column. |
void
|
setEditable(<Number> col, <Boolean> editable)
Sets if a column is editable. |
void
|
setEditor(<Number> col, <Object> editor)
Sets the editor for a column. |
void
|
setHidden(<Number> colIndex, hidden)
Sets if a column is hidden. |
void
|
setRenderer(<Number> col, <Function> fn)
Sets the rendering (formatting) function for a column. |
void
|
setSortType(<Number> col, <Function> fn)
Sets the sorting comparison function for a column. |
<static> Object
|
defaultRenderer(value)
Default empty rendering function |
| Methods inherited from class YAHOO.ext.grid.AbstractColumnModel |
fireWidthChange, fireHeaderChange, fireHiddenChange
|
| Field Detail |
Object config
Boolean defaultSortable
Number defaultWidth
<static> Object sortTypes
| Constructor Detail |
YAHOO.ext.grid.DefaultColumnModel(config)
| Method Detail |
Object getCellEditor(<Number> colIndex, <Number> rowIndex)
colIndex - The column index
rowIndex - The row index
Number getColumnCount()
String getColumnHeader(<Number> col)
col - The column index
Number getColumnWidth(<Number> col)
col - The column index
Number getDataIndex(<Number> col)
col - The column index
Function getRenderer(<Number> col)
col - The column index
Function getSortType(<Number> col)
col - The column index
Number getTotalWidth(<Boolean> includeHidden)
includeHidden - True to include hidden column widths
Boolean isCellEditable(<Number> colIndex, <Number> rowIndex)
colIndex - The column index
rowIndex - The row index
Boolean isHidden(<Number> colIndex)
colIndex - The column index
Boolean isSortable(<Number> col)
col - The column index
void setColumnHeader(<Number> col, <String> header)
col - The column index
header - The new header
void setColumnWidth(<Number> col, <Number> width, suppressEvent)
col - The column index
width - The new width
void setDataIndex(<Number> col, <Number> dataIndex)
col - The column index
dataIndex - The new dataIndex
void setEditable(<Number> col, <Boolean> editable)
col - The column index
editable - True if the column is editable
void setEditor(<Number> col, <Object> editor)
col - The column index
editor - The editor object
void setHidden(<Number> colIndex, hidden)
colIndex - The column index
void setRenderer(<Number> col, <Function> fn)
col - The column index
fn -
void setSortType(<Number> col, <Function> fn)
col - The column index
fn -
<static> Object defaultRenderer(value)