This is the default implementation of a ColumnModel used by the Grid. It defines
the columns in the grid.
Usage:
var colModel = new Ext.grid.ColumnModel([
{header: "Ticker", width: 60, sortable: true, locked: true},
{header: "Company Name", width: 150, sortable: true},
{header: "Market Cap.", width: 100, sortable: true},
{header: "$ Sales", width: 100, sortable: true, renderer: money},
{header: "Employees", width: 100, sortable: true, resizable: false}
]);
|
ColumnModel(Object config ) |
ColumnModel |
|
|
addEvents(Object object ) : void |
Observable |
Copies any events from the passed object onto this object if they do not already exist. The passed object
must also ... |
|
addListener(String eventName , Function handler , [Object options ]) : void |
Observable |
Appends an event handler to this component |
|
fireEvent(String eventName , Object... args ) : Boolean |
Observable |
Fires the specified event with the passed parameters (minus the event name). |
|
getCellEditor(Number colIndex , Number rowIndex ) : Object |
ColumnModel |
Returns the editor defined for the cell/column. |
|
getColumnCount() : Number |
ColumnModel |
Returns the number of columns. |
|
getColumnHeader(Number col ) : String |
ColumnModel |
Returns the header for the specified column. |
|
getColumnId(Number index ) : String |
ColumnModel |
Returns the id of the column at the specified index |
|
getColumnTooltip(Number col ) : String |
ColumnModel |
Returns the tooltip for the specified column. |
|
getColumnWidth(Number col ) : Number |
ColumnModel |
Returns the width for the specified column. |
|
getDataIndex(Number col ) : Number |
ColumnModel |
Returns the dataIndex for the specified column. |
|
getRenderer(Number col ) : Function |
ColumnModel |
Returns the rendering (formatting) function defined for the column. |
|
getTotalWidth(Boolean includeHidden ) : Number |
ColumnModel |
Returns the total width of all columns. |
|
hasListener(String eventName ) : Boolean |
Observable |
Checks to see if this object is currently listening for a specified event |
|
isCellEditable(Number colIndex , Number rowIndex ) : Boolean |
ColumnModel |
Returns true if the cell is editable. |
|
isFixed() : void |
ColumnModel |
Returns true if the column width cannot be changed |
|
isHidden(Number colIndex ) : Boolean |
ColumnModel |
Returns true if the column is hidden. |
|
isResizable() : Boolean |
ColumnModel |
Returns true if the column cannot be resized |
|
isSortable(Number col ) : Boolean |
ColumnModel |
Returns true if the specified column is sortable. |
|
on(String eventName , Function handler , [Object options ]) : void |
Observable |
Appends an event handler to this element (shorthand for addListener) |
|
purgeListeners() : void |
Observable |
Removes all listeners for this object |
|
removeListener(String eventName , Function handler , [Object scope ]) : void |
Observable |
Removes a listener |
|
setColumnHeader(Number col , String header ) : void |
ColumnModel |
Sets the header for a column. |
|
setColumnTooltip(Number col , String tooltip ) : void |
ColumnModel |
Sets the tooltip for a column. |
|
setColumnWidth(Number col , Number width ) : void |
ColumnModel |
Sets the width for a column. |
|
setDataIndex(Number col , Number dataIndex ) : void |
ColumnModel |
Sets the dataIndex for a column. |
|
setEditable(Number col , Boolean editable ) : void |
ColumnModel |
Sets if a column is editable. |
|
setEditor(Number col , Object editor ) : void |
ColumnModel |
Sets the editor for a column. |
|
setHidden(Number colIndex ) : void |
ColumnModel |
Sets if a column is hidden. |
|
setRenderer(Number col , Function fn ) : void |
ColumnModel |
Sets the rendering (formatting) function for a column. |
|
un(String eventName , Function handler , [Object scope ]) : void |
Observable |
Removes a listener (shorthand for removeListener) |
|
columlockchange : (ColumnModel this , Number colIndex , Boolean locked ) |
ColumnModel |
Fires when a column's locked state is changed |
|
columnmoved : (ColumnModel this , Number oldIndex , Number newIndex ) |
ColumnModel |
Fires when a column is moved |
|
headerchange : (ColumnModel this , Number columnIndex , Number newText ) |
ColumnModel |
Fires when the text of a header changes |
|
hiddenchange : (ColumnModel this , Number columnIndex , Number hidden ) |
ColumnModel |
Fires when a column is hidden or "unhidden" |
|
widthchange : (ColumnModel this , Number columnIndex , Number newWidth ) |
ColumnModel |
Fires when the width of a column changes |
addEvents
public function addEvents(Object object
)
Copies any events from the passed object onto this object if they do not already exist. The passed object
must also inherit from Observable for this method to have any effect.
addListener
public function addListener(String eventName
, Function handler
, [Object options
])
Appends an event handler to this component
fireEvent
public function fireEvent(String eventName
, Object... args
)
Fires the specified event with the passed parameters (minus the event name).
getCellEditor
public function getCellEditor(Number colIndex
, Number rowIndex
)
Returns the editor defined for the cell/column.
Parameters:
colIndex
: NumberThe column index
rowIndex
: NumberThe row index
Returns:
This method is defined by ColumnModel.
getColumnCount
public function getColumnCount()
Returns the number of columns.
This method is defined by ColumnModel.
getColumnHeader
public function getColumnHeader(Number col
)
Returns the header for the specified column.
Parameters:
col
: NumberThe column index
Returns:
This method is defined by ColumnModel.
getColumnId
public function getColumnId(Number index
)
Returns the id of the column at the specified index
This method is defined by ColumnModel.
getColumnTooltip
public function getColumnTooltip(Number col
)
Returns the tooltip for the specified column.
Parameters:
col
: NumberThe column index
Returns:
This method is defined by ColumnModel.
getColumnWidth
public function getColumnWidth(Number col
)
Returns the width for the specified column.
Parameters:
col
: NumberThe column index
Returns:
This method is defined by ColumnModel.
getDataIndex
public function getDataIndex(Number col
)
Returns the dataIndex for the specified column.
Parameters:
col
: NumberThe column index
Returns:
This method is defined by ColumnModel.
getRenderer
public function getRenderer(Number col
)
Returns the rendering (formatting) function defined for the column.
Parameters:
col
: NumberThe column index
Returns:
This method is defined by ColumnModel.
getTotalWidth
public function getTotalWidth(Boolean includeHidden
)
Returns the total width of all columns.
This method is defined by ColumnModel.
hasListener
public function hasListener(String eventName
)
Checks to see if this object is currently listening for a specified event
isCellEditable
public function isCellEditable(Number colIndex
, Number rowIndex
)
Returns true if the cell is editable.
Parameters:
colIndex
: NumberThe column index
rowIndex
: NumberThe row index
Returns:
This method is defined by ColumnModel.
isFixed
public function isFixed()
Returns true if the column width cannot be changed
This method is defined by ColumnModel.
isHidden
public function isHidden(Number colIndex
)
Returns true if the column is hidden.
Parameters:
colIndex
: NumberThe column index
Returns:
This method is defined by ColumnModel.
isResizable
public function isResizable()
Returns true if the column cannot be resized
This method is defined by ColumnModel.
isSortable
public function isSortable(Number col
)
Returns true if the specified column is sortable.
Parameters:
col
: NumberThe column index
Returns:
This method is defined by ColumnModel.
on
public function on(String eventName
, Function handler
, [Object options
])
Appends an event handler to this element (shorthand for addListener)
purgeListeners
public function purgeListeners()
Removes all listeners for this object
removeListener
public function removeListener(String eventName
, Function handler
, [Object scope
])
setColumnHeader
public function setColumnHeader(Number col
, String header
)
Sets the header for a column.
Parameters:
col
: NumberThe column index
header
: StringThe new header
Returns:
This method is defined by ColumnModel.
setColumnTooltip
public function setColumnTooltip(Number col
, String tooltip
)
Sets the tooltip for a column.
Parameters:
col
: NumberThe column index
tooltip
: StringThe new tooltip
Returns:
This method is defined by ColumnModel.
setColumnWidth
public function setColumnWidth(Number col
, Number width
)
Sets the width for a column.
Parameters:
col
: NumberThe column index
width
: NumberThe new width
Returns:
This method is defined by ColumnModel.
setDataIndex
public function setDataIndex(Number col
, Number dataIndex
)
Sets the dataIndex for a column.
Parameters:
col
: NumberThe column index
dataIndex
: NumberThe new dataIndex
Returns:
This method is defined by ColumnModel.
setEditable
public function setEditable(Number col
, Boolean editable
)
Sets if a column is editable.
This method is defined by ColumnModel.
setEditor
public function setEditor(Number col
, Object editor
)
Sets the editor for a column.
Parameters:
col
: NumberThe column index
editor
: ObjectThe editor object
Returns:
This method is defined by ColumnModel.
setHidden
public function setHidden(Number colIndex
)
Sets if a column is hidden.
Parameters:
colIndex
: NumberThe column index
Returns:
This method is defined by ColumnModel.
setRenderer
public function setRenderer(Number col
, Function fn
)
Sets the rendering (formatting) function for a column.
Parameters:
col
: NumberThe column index
fn
: Function
Returns:
This method is defined by ColumnModel.
un
public function un(String eventName
, Function handler
, [Object scope
])
Removes a listener (shorthand for removeListener)