X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/d41dc04ad17d1d9125fb2cf72db2b4782dbe3a8c..c8256059947f3aa8f5b0a9a2acf55e2142bb4742:/docs/output/Ext.grid.ColumnModel.html diff --git a/docs/output/Ext.grid.ColumnModel.html b/docs/output/Ext.grid.ColumnModel.html index a6f22f32..627c5f04 100644 --- a/docs/output/Ext.grid.ColumnModel.html +++ b/docs/output/Ext.grid.ColumnModel.html @@ -1,1094 +1,362 @@ -
Observable - ColumnModel
Package: | Ext.grid |
Defined In: | ColumnModel.js |
Class: | ColumnModel |
Subclasses: | PropertyColumnModel |
Extends: | Observable |
var colModel = new Ext.grid.ColumnModel([
+Observable
ColumnModel
Class Ext.grid.ColumnModel
Package: Ext.grid Defined In: ColumnModel.js Class: ColumnModel Subclasses: PropertyColumnModel Extends: Observable
After the data has been read into the client side cache (Store),
+the ColumnModel is used to configure how and what parts of that data will be displayed in the
+vertical slices (columns) of the grid. The Ext.grid.ColumnModel Class is the default implementation
+of a ColumnModel used by implentations of GridPanel.
+Data is mapped into the store's records and then indexed into the ColumnModel using the
+dataIndex:
+{data source} == mapping ==> {data store} == dataIndex ==> {ColumnModel}
+Each Column in the grid's ColumnModel is configured with a
+dataIndex to specify how the data within
+each record in the store is indexed into the ColumnModel.
+There are two ways to initialize the ColumnModel class:
+Initialization Method 1: an Array
+var colModel = new Ext.grid.ColumnModel([
{ header: "Ticker", width: 60, sortable: true},
- { header: "Company Name", width: 150, sortable: true},
+ { header: "Company Name", width: 150, sortable: true, id: 'company'},
{ header: "Market Cap.", width: 100, sortable: true},
{ header: "$ Sales", width: 100, sortable: true, renderer: money},
{ header: "Employees", width: 100, sortable: true, resizable: false}
]);
-
-The config options defined by this class are options which may appear in each
-individual column definition. In order to use configuration options from the superclass,
-specify the column configuration Array in the columns config property. eg:var colModel = new Ext.grid.ColumnModel({
+The ColumnModel may be initialized with an Array of Ext.grid.Column column configuration
+objects to define the initial layout / display of the columns in the Grid. The order of each
+Ext.grid.Column column configuration object within the specified Array defines the initial
+order of the column display. A Column's display may be initially hidden using the
+hidden
config property (and then shown using the column
+header menu). Fields that are not included in the ColumnModel will not be displayable at all.
+How each column in the grid correlates (maps) to the Ext.data.Record field in the
+Store the column draws its data from is configured through the
+dataIndex. If the
+dataIndex is not explicitly defined (as shown in the
+example above) it will use the column configuration's index in the Array as the index.
+See Ext.grid.Column for additional configuration options for each column.
+Initialization Method 2: an Object
+In order to use configuration options from Ext.grid.ColumnModel, an Object may be used to
+initialize the ColumnModel. The column configuration Array will be specified in the columns
+config property. The defaults config property can be used to apply defaults
+for all columns, e.g.:
var colModel = new Ext.grid.ColumnModel({
+ columns: [
+ { header: "Ticker", width: 60, menuDisabled: false},
+ { header: "Company Name", width: 150, id: 'company'},
+ { header: "Market Cap."},
+ { header: "$ Sales", renderer: money},
+ { header: "Employees", resizable: false}
+ ],
+ defaults: {
+ sortable: true,
+ menuDisabled: true,
+ width: 100
+ },
listeners: {
- widthchange: function(cm, colIndex, width) {
- saveConfig(colIndex, width);
+ hiddenchange: function(cm, colIndex, hidden) {
+ saveConfig(colIndex, hidden);
+ }
+ }
+});
+In both examples above, the ability to apply a CSS class to all cells in a column (including the
+header) is demonstrated through the use of the id config
+option. This column could be styled by including the following css:
//add this css *after* the core css is loaded
+.x-grid3-td-company {
+ color: red; // entire column will have red font
+}
+// modify the header row only, adding an icon to the column header
+.x-grid3-hd-company {
+ background: transparent
+ url(../../resources/images/icons/silk/building.png)
+ no-repeat 3px 3px ! important;
+ padding-left:20px;
+}
+Note that the "Company Name" column could be specified as the
+Ext.grid.GridPanel.autoExpandColumn.Config Options
Config Options Defined By columns : ArrayAn Array of object literals. The config options defined by
+Ext.grid.Column are the options which may appear in the o...An Array of object literals. The config options defined by
+Ext.grid.Column are the options which may appear in the object literal for each
+individual column definition. ColumnModel defaultSortable : BooleanDefault sortable of columns which have no
+sortable specified (defaults to false). This property shall preferably be ...Default sortable of columns which have no
+sortable specified (defaults to false). This property shall preferably be configured
+through the defaults config property. ColumnModel defaultWidth : Number ColumnModel defaults : ObjectObject literal which will be used to apply Ext.grid.Column
+configuration options to all columns. Configuration optio...Object literal which will be used to apply Ext.grid.Column
+configuration options to all columns. Configuration options specified with
+individual column configs will supersede these defaults. ColumnModel listeners : ObjectA config object containing one or more event handlers to be added to this
+object during initialization. This should ...A config object containing one or more event handlers to be added to this
+object during initialization. This should be a valid listeners config object as specified in the
+addListener example for attaching multiple handlers at once.
+
DOM events from ExtJs Components
+
While some ExtJs Component classes export selected DOM events (e.g. "click", "mouseover" etc), this
+is usually only done when extra value can be added. For example the DataView's
+click
event passing the node clicked on. To access DOM
+events directly from a Component's HTMLElement, listeners must be added to the Element after the Component
+has been rendered. A plugin can simplify this step:
// Plugin is configured with a listeners config object.
+// The Component is appended to the argument list of all handler functions.
+Ext.DomObserver = Ext.extend(Object, {
+ constructor: function(config) {
+ this.listeners = config.listeners ? config.listeners : config;
+ },
+
+ // Component passes itself into plugin's init method
+ init: function(c) {
+ var p, l = this.listeners;
+ for (p in l) {
+ if (Ext.isFunction(l[p])) {
+ l[p] = this.createHandler(l[p], c);
+ } else {
+ l[p].fn = this.createHandler(l[p].fn, c);
+ }
}
+
+ // Add the listeners to the Element immediately following the render call
+ c.render = c.render.createSequence(function() {
+ var e = c.getEl();
+ if (e) {
+ e.on(l);
+ }
+ });
},
- columns: [
- { header: "Ticker", width: 60, sortable: 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}
- ]
-});
-
-
-
- Config Options
-
-
- Config Options
- Defined By
-
-
-
-
-
- align : String
- (optional) Set the CSS text-align property of the column. Defaults to undefined.
-
- ColumnModel
-
-
-
-
-
- css : String
- (optional) Set custom CSS for all table cells in the column (excluding headers). Defaults to undefined.
-
- ColumnModel
-
-
-
-
-
- dataIndex : String
- (optional) The name of the field in the grid's Ext.data.Store's Ext.data.Record definition from which to draw the col...
-
- (optional) The name of the field in the grid's Ext.data.Store's Ext.data.Record definition from which to draw the column's value. If not specified, the column's index is used as an index into the Record's data Array.
-
-
- ColumnModel
-
-
-
-
-
- editor : Ext.form.Field
- (optional) The Ext.form.Field to use when editing values in this column if editing is supported by the grid.
-
- ColumnModel
-
-
-
-
-
- fixed : Boolean
- (optional) True if the column width cannot be changed. Defaults to false.
-
- ColumnModel
-
-
-
-
-
- header : String
- The header text to display in the Grid view.
-
- ColumnModel
-
-
-
-
-
- (optional) True to hide the column. Defaults to false.
-
-
- hidden : Boolean ColumnModel
-
-
-
-
-
- hideable : Boolean
- (optional) Specify as false to prevent the user from hiding this column (defaults to true). To disallow column hiding...
-
- (optional) Specify as false to prevent the user from hiding this column (defaults to true). To disallow column hiding globally for all columns in the grid, use Ext.grid.GridPanel.enableColumnHide instead.
-
-
- ColumnModel
-
-
-
-
-
- id : String
- (optional) Defaults to the column's initial ordinal position. A name which identifies this column. The id is used to ...
-
- (optional) Defaults to the column's initial ordinal position. A name which identifies this column. The id is used to create a CSS class name which is applied to all table cells (including headers) in that column. The class name takes the form of x-grid3-td-id
Header cells will also recieve this class name, but will also have the class x-grid3-hd, so to target header cells, use CSS selectors such as:.x-grid3-hd.x-grid3-td-id
The Ext.grid.GridPanel.autoExpandColumn grid config option references the column via this identifier.
-
-
- ColumnModel
-
-
-
-
-
- listeners : Object
- (optional) A config object containing one or more event handlers to be added to this object during initialization. Th...
-
- (optional) A config object containing one or more event handlers to be added to this object during initialization. This should be a valid listeners config object as specified in the addListener example for attaching multiple handlers at once.
-
-
- Observable
-
-
-
-
-
- menuDisabled : Boolean
- (optional) True to disable the column menu. Defaults to false.
-
- ColumnModel
-
-
-
-
-
- renderer : Function
- (optional) A function used to generate HTML markup for a cell given the cell's data value. See setRenderer. If not sp...
-
- (optional) A function used to generate HTML markup for a cell given the cell's data value. See setRenderer. If not specified, the default renderer uses the raw data value.
-
-
- ColumnModel
-
-
-
-
-
- resizable : Boolean
- (optional) False to disable column resizing. Defaults to true.
-
- ColumnModel
-
-
-
-
-
- sortable : Boolean
- (optional) True if sorting is to be allowed on this column. Defaults to the value of the defaultSortable property. Wh...
-
- (optional) True if sorting is to be allowed on this column. Defaults to the value of the defaultSortable property. Whether local/remote sorting is used is specified in Ext.data.Store.remoteSort.
-
-
- ColumnModel
-
-
-
-
-
- tooltip : String
- (optional) A text string to use as the column header's tooltip. If Quicktips are enabled, this value will be used as ...
-
- (optional) A text string to use as the column header's tooltip. If Quicktips are enabled, this value will be used as the text of the quick tip, otherwise it will be set as the header's HTML title attribute. Defaults to ''.
-
-
- ColumnModel
-
-
-
-
-
- width : Number
-
- ColumnModel
-
-
-
- Public Properties
-
- Public Methods
-
-
- Method
- Defined By
-
-
-
-
-
- ColumnModel( Object config
)
-
-
-
- Parameters:
- config
: ObjectAn Array of column config objects. See this class's
-config objects for details.
- Returns:
-
-
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- addEvents( Object object
) : void
- Used to define events on this Observable
-
- Used to define events on this Observable
- Parameters:
- object
: ObjectThe object with the events defined
- Returns:
-
- void
-
-
-
-
-
- Observable
-
-
-
-
-
- addListener( String eventName
, Function handler
, [Object scope
], [Object options
] ) : void
- Appends an event handler to this component
-
- Appends an event handler to this component
- Parameters:
- eventName
: StringThe type of event to listen forhandler
: FunctionThe method the event invokesscope
: Object(optional) The scope in which to execute the handler
-function. The handler function's "this" context.options
: Object(optional) An object containing handler configuration
+
+ createHandler: function(fn, c) {
+ return function(e) {
+ fn.call(this, e, c);
+ };
+ }
+});
+
+var combo = new Ext.form.ComboBox({
+
+ // Collapse combo when its element is clicked on
+ plugins: [ new Ext.DomObserver({
+ click: function(evt, comp) {
+ comp.collapse();
+ }
+ })],
+ store: myStore,
+ typeAhead: true,
+ mode: 'local',
+ triggerAction: 'all'
+});
Observable
Public Properties
Property Defined By config : ArrayAn Array of Column definition objects representing the configuration
+of this ColumnModel. See Ext.grid.Column for th...An Array of Column definition objects representing the configuration
+of this ColumnModel. See Ext.grid.Column for the configuration properties that may
+be specified. ColumnModel
Public Methods
Method Defined By ColumnModel( Mixed config
)
+ Parameters:config
: MixedSpecify either an Array of Ext.grid.Column configuration objects or specify
+a configuration Object (see introductory section discussion utilizing Initialization Method 2 above).
Returns:- void
ColumnModel addEvents( Object|String o
, string Optional.
)
+ :
+ voidAdds the specified events to the list of events which this Observable may fire.Adds the specified events to the list of events which this Observable may fire.Parameters:o
: Object|StringEither an object with event names as properties with a value of true
+or the first event name string if multiple event names are being passed as separate parameters.Optional.
: stringEvent name if multiple event names are being passed as separate parameters.
+Usage:this.addEvents('storeloaded', 'storecleared');
Returns:- void
Observable addListener( String eventName
, Function handler
, [Object scope
], [Object options
] )
+ :
+ voidAppends an event handler to this object.Appends an event handler to this object.Parameters:eventName
: StringThe name of the event to listen for.handler
: FunctionThe method the event invokes.scope
: Object(optional) The scope (this
reference) in which the handler function is executed.
+If omitted, defaults to the object which fired the event.options
: Object(optional) An object containing handler configuration.
properties. This may contain any of the following properties:
-- scope : Object
The scope in which to execute the handler function. The handler function's "this" context.
-- delay : Number
The number of milliseconds to delay the invocation of the handler after the event fires.
-- single : Boolean
True to add a handler to handle just the next firing of the event, and then remove itself.
-- buffer : Number
Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed
+
- scope : ObjectThe scope (
this
reference) in which the handler function is executed.
+If omitted, defaults to the object which fired the event.
+- delay : NumberThe number of milliseconds to delay the invocation of the handler after the event fires.
+- single : BooleanTrue to add a handler to handle just the next firing of the event, and then remove itself.
+- buffer : NumberCauses the handler to be scheduled to run in an Ext.util.DelayedTask delayed
by the specified number of milliseconds. If the event fires again within that time, the original
-handler is not invoked, but the new handler is scheduled in its place.
+handler is not invoked, but the new handler is scheduled in its place.
+- target : ObservableOnly call the handler if the event was fired on the target Observable, not
+if the event was bubbled up from a child Observable.
Combining Options
Using the options argument, it is possible to combine different types of listeners:
-A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)
-
el.on('click', this.onClick, this, {
- single: true,
- delay: 100,
- forumId: 4
+A delayed, one-time listener.
+myDataView.on('click', this.onClick, this, {
+single: true,
+delay: 100
});
Attaching multiple handlers in 1 call
The method also allows for a single argument to be passed which is a config object containing properties
which specify multiple handlers.
-
foo.on({
- 'click' : {
- fn: this.onClick,
- scope: this,
- delay: 100
- },
- 'mouseover' : {
- fn: this.onMouseOver,
- scope: this
- },
- 'mouseout' : {
- fn: this.onMouseOut,
- scope: this
- }
+myGridPanel.on({
+'click' : {
+ fn: this.onClick,
+ scope: this,
+ delay: 100
+},
+'mouseover' : {
+ fn: this.onMouseOver,
+ scope: this
+},
+'mouseout' : {
+ fn: this.onMouseOut,
+ scope: this
+}
});
Or a shorthand syntax:
-
foo.on({
- 'click' : this.onClick,
- 'mouseover' : this.onMouseOver,
- 'mouseout' : this.onMouseOut,
- scope: this
-});
- Returns:
-
- void
-
-
-
-
-
- Observable
-
-
-
-
-
- findColumnIndex( String col
) : Number
- Finds the index of the first matching column for the given dataIndex.
-
- Finds the index of the first matching column for the given dataIndex.
- Parameters:
- col
: StringThe dataIndex to find
- Returns:
-
- Number
The column index, or -1 if no match was found
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- fireEvent( String eventName
, Object... args
) : Boolean
- Fires the specified event with the passed parameters (minus the event name).
-
- Fires the specified event with the passed parameters (minus the event name).
- Parameters:
- eventName
: Stringargs
: Object...Variable number of parameters are passed to handlers
- Returns:
-
- Boolean
returns false if any of the handlers return false otherwise it returns true
-
-
-
-
-
- Observable
-
-
-
-
-
- getCellEditor( Number colIndex
, Number rowIndex
) : Ext.Editor
- Returns the editor defined for the cell/column.
-
- Returns the editor defined for the cell/column.
- Parameters:
- colIndex
: NumberThe column indexrowIndex
: NumberThe row index
- Returns:
-
- Ext.Editor
The {@link Ext.Editor Editor} that was created to wrap the {@link Ext.form.Field Field} used to edit the cell.
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- getColumnById( String id
) : Object
- Returns the column for a specified id.
-
- Returns the column for a specified id.
- Parameters:
- id
: StringThe column id
- Returns:
-
- Object
the column
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- getColumnCount( Boolean visibleOnly
) : Number
- Returns the number of columns.
-
- Returns the number of columns.
- Parameters:
- visibleOnly
: BooleanOptional. Pass as true to only include visible columns.
- Returns:
-
- Number
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- getColumnHeader( Number col
) : String
- Returns the header for the specified column.
-
- Returns the header for the specified column.
- Parameters:
- col
: NumberThe column index
- Returns:
-
- String
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- getColumnId( Number index
) : String
-
-Returns the id of the column at the specified index.
-
-
-Returns the id of the column at the specified index.
- Parameters:
- index
: NumberThe column index
- Returns:
-
- String
the id
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- getColumnTooltip( Number col
) : String
- Returns the tooltip for the specified column.
-
- Returns the tooltip for the specified column.
- Parameters:
- col
: NumberThe column index
- Returns:
-
- String
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- getColumnWidth( Number col
) : Number
- Returns the width for the specified column.
-
- Returns the width for the specified column.
- Parameters:
- col
: NumberThe column index
- Returns:
-
- Number
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- getColumnsBy( Function fn
, [Object scope
] ) : Array
- Returns the column configs that return true by the passed function that is called with (columnConfig, index)
-
- Returns the column configs that return true by the passed function that is called with (columnConfig, index)
- Parameters:
- fn
: Functionscope
: Object(optional)
- Returns:
-
- Array
result
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- getDataIndex( Number col
) : String
- Returns the dataIndex for the specified column.
-
- Returns the dataIndex for the specified column.
- Parameters:
- col
: NumberThe column index
- Returns:
-
- String
The column's dataIndex
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- getIndexById( String id
) : Number
- Returns the index for a specified column id.
-
- Returns the index for a specified column id.
- Parameters:
- id
: StringThe column id
- Returns:
-
- Number
the index, or -1 if not found
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- getRenderer( Number col
) : Function
- Returns the rendering (formatting) function defined for the column.
-
- Returns the rendering (formatting) function defined for the column.
- Parameters:
- col
: NumberThe column index.
- Returns:
-
- Function
The function used to render the cell. See {@link #setRenderer}.
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- getTotalWidth( Boolean includeHidden
) : Number
- Returns the total width of all columns.
-
- Returns the total width of all columns.
- Parameters:
- includeHidden
: BooleanTrue to include hidden column widths
- Returns:
-
- Number
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- hasListener( String eventName
) : Boolean
- Checks to see if this object has any listeners for a specified event
-
- Checks to see if this object has any listeners for a specified event
- Parameters:
- eventName
: StringThe name of the event to check for
- Returns:
-
- Boolean
True if the event is being listened for, else false
-
-
-
-
-
- Observable
-
-
-
-
-
- isCellEditable( Number colIndex
, Number rowIndex
) : Boolean
- Returns true if the cell is editable.
-
- Returns true if the cell is editable.
- Parameters:
- colIndex
: NumberThe column indexrowIndex
: NumberThe row index
- Returns:
-
- Boolean
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- isFixed() : void
- Returns true if the column width cannot be changed
-
- Returns true if the column width cannot be changed
- Parameters:
- - None.
- Returns:
-
- void
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- isHidden( Number colIndex
) : Boolean
- Returns true if the column is hidden.
-
- Returns true if the column is hidden.
- Parameters:
- colIndex
: NumberThe column index
- Returns:
-
- Boolean
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- isMenuDisabled( Number col
) : Boolean
- Returns true if the specified column menu is disabled.
-
- Returns true if the specified column menu is disabled.
- Parameters:
- col
: NumberThe column index
- Returns:
-
- Boolean
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- isResizable() : Boolean
- Returns true if the column can be resized
-
- Returns true if the column can be resized
- Parameters:
- - None.
- Returns:
-
- Boolean
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- isSortable( Number col
) : Boolean
- Returns true if the specified column is sortable.
-
- Returns true if the specified column is sortable.
- Parameters:
- col
: NumberThe column index
- Returns:
-
- Boolean
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- moveColumn( Number oldIndex
, Number newIndex
) : void
- Moves a column from one position to another.
-
- Moves a column from one position to another.
- Parameters:
- oldIndex
: NumberThe index of the column to move.newIndex
: NumberThe position at which to reinsert the coolumn.
- Returns:
-
- void
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- on( String eventName
, Function handler
, [Object scope
], [Object options
] ) : void
- Appends an event handler to this element (shorthand for addListener)
-
- Appends an event handler to this element (shorthand for addListener)
- Parameters:
- eventName
: StringThe type of event to listen forhandler
: FunctionThe method the event invokesscope
: Object(optional) The scope in which to execute the handler
-function. The handler function's "this" context.options
: Object(optional)
- Returns:
-
- void
-
-
-
-
-
- Observable
-
-
-
-
-
- purgeListeners() : void
- Removes all listeners for this object
-
- Removes all listeners for this object
- Parameters:
- - None.
- Returns:
-
- void
-
-
-
-
-
- Observable
-
-
-
-
-
- relayEvents( Object o
, Array events
) : void
- Relays selected events from the specified Observable as if the events were fired by this.
-
- Relays selected events from the specified Observable as if the events were fired by this.
- Parameters:
- o
: ObjectThe Observable whose events this object is to relay.events
: ArrayArray of event names to relay.
- Returns:
-
- void
-
-
-
-
-
- Observable
-
-
-
-
-
- removeListener( String eventName
, Function handler
, [Object scope
] ) : void
- Removes a listener
-
- Removes a listener
- Parameters:
- eventName
: StringThe type of event to listen forhandler
: FunctionThe handler to removescope
: Object(optional) The scope (this object) for the handler
- Returns:
-
- void
-
-
-
-
-
- Observable
-
-
-
-
-
- resumeEvents() : void
- Resume firing events. (see suspendEvents)
-
- Resume firing events. (see suspendEvents)
- Parameters:
- - None.
- Returns:
-
- void
-
-
-
-
-
- Observable
-
-
-
-
-
- setColumnHeader( Number col
, String header
) : void
- Sets the header for a column.
-
- Sets the header for a column.
- Parameters:
- col
: NumberThe column indexheader
: StringThe new header
- Returns:
-
- void
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- setColumnTooltip( Number col
, String tooltip
) : void
- Sets the tooltip for a column.
-
- Sets the tooltip for a column.
- Parameters:
- col
: NumberThe column indextooltip
: StringThe new tooltip
- Returns:
-
- void
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- setColumnWidth( Number col
, Number width
) : void
- Sets the width for a column.
-
- Sets the width for a column.
- Parameters:
- col
: NumberThe column indexwidth
: NumberThe new width
- Returns:
-
- void
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- setConfig( Array config
) : void
- Reconfigures this column model according to the passed Array of column definition objects. For a description of
-the i...
-
- Reconfigures this column model according to the passed Array of column definition objects. For a description of
-the individual properties of a column definition object, see the Config Options.
-Causes the configchange event to be fired. A GridPanel using
-this ColumnModel will listen for this event and refresh its UI automatically.
- Parameters:
- config
: ArrayArray of Column definition objects.
- Returns:
-
- void
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- setDataIndex( Number col
, String dataIndex
) : void
- Sets the dataIndex for a column.
-
- Sets the dataIndex for a column.
- Parameters:
- col
: NumberThe column indexdataIndex
: StringThe new dataIndex
- Returns:
-
- void
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- setEditable( Number col
, Boolean editable
) : void
- Sets if a column is editable.
-
- Sets if a column is editable.
- Parameters:
- col
: NumberThe column indexeditable
: BooleanTrue if the column is editable
- Returns:
-
- void
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- setEditor( Number col
, Object editor
) : void
- Sets the editor for a column.
-
- Sets the editor for a column.
- Parameters:
- col
: NumberThe column indexeditor
: ObjectThe editor object
- Returns:
-
- void
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- setHidden( Number colIndex
, Boolean hidden
) : void
- Sets if a column is hidden.
-
- Sets if a column is hidden.
- Parameters:
- colIndex
: NumberThe column indexhidden
: BooleanTrue if the column is hidden
- Returns:
-
- void
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- setRenderer( Number col
, Function fn
) : void
- Sets the rendering (formatting) function for a column. See Ext.util.Format for some
-default formatting functions.
-
- Sets the rendering (formatting) function for a column. See Ext.util.Format for some
-default formatting functions.
- Parameters:
- col
: NumberThe column indexfn
: FunctionThe function to use to process the cell's raw data
+myGridPanel.on({
+'click' : this.onClick,
+'mouseover' : this.onMouseOver,
+'mouseout' : this.onMouseOut,
+ scope: this
+});
Returns:- void
Observable destroy()
+ :
+ voidDestroys this column model by purging any event listeners, and removing any editors.Destroys this column model by purging any event listeners, and removing any editors.Parameters:- None.
Returns:- void
ColumnModel enableBubble( String/Array events
)
+ :
+ voidEnables events fired by this Observable to bubble up an owner hierarchy by calling
+this.getBubbleTarget() if present....Enables events fired by this Observable to bubble up an owner hierarchy by calling
+this.getBubbleTarget()
if present. There is no implementation in the Observable base class.
+This is commonly used by Ext.Components to bubble events to owner Containers. See Ext.Component.getBubbleTarget. The default
+implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to
+access the required target more quickly.
+Example:
Ext.override(Ext.form.Field, {
+ // Add functionality to Field's initComponent to enable the change event to bubble
+ initComponent : Ext.form.Field.prototype.initComponent.createSequence(function() {
+ this.enableBubble('change');
+ }),
+
+ // We know that we want Field's events to bubble directly to the FormPanel.
+ getBubbleTarget : function() {
+ if (!this.formPanel) {
+ this.formPanel = this.findParentByType('form');
+ }
+ return this.formPanel;
+ }
+});
+
+var myForm = new Ext.formPanel({
+ title: 'User Details',
+ items: [{
+ ...
+ }],
+ listeners: {
+ change: function() {
+ // Title goes red if form has been modified.
+ myForm.header.setStyle('color', 'red');
+ }
+ }
+});
Parameters:events
: String/ArrayThe event name to bubble, or an Array of event names.
Returns:- void
Observable findColumnIndex( String col
)
+ :
+ NumberFinds the index of the first matching column for the given dataIndex.Finds the index of the first matching column for the given dataIndex.Parameters:col
: StringThe dataIndex to find
Returns:Number
The column index, or -1 if no match was found
ColumnModel fireEvent( String eventName
, Object... args
)
+ :
+ BooleanFires the specified event with the passed parameters (minus the event name).
+An event may be set to bubble up an Obse...Fires the specified event with the passed parameters (minus the event name).
+An event may be set to bubble up an Observable parent hierarchy (See Ext.Component.getBubbleTarget)
+by calling enableBubble.
Parameters:eventName
: StringThe name of the event to fire.args
: Object...Variable number of parameters are passed to handlers.
Returns:Boolean
returns false if any of the handlers return false otherwise it returns true.
Observable getCellEditor( Number colIndex
, Number rowIndex
)
+ :
+ Ext.EditorReturns the editor defined for the cell/column.Returns the editor defined for the cell/column.Parameters:colIndex
: NumberThe column indexrowIndex
: NumberThe row index
Returns:Ext.Editor
The {@link Ext.Editor Editor} that was created to wrap
+the {@link Ext.form.Field Field} used to edit the cell.
ColumnModel getColumnById( String id
)
+ :
+ ObjectReturns the column for a specified id.Returns the column for a specified id.Parameters:id
: StringThe column id
Returns:Object
the column
ColumnModel getColumnCount( Boolean visibleOnly
)
+ :
+ NumberReturns the number of columns.Returns the number of columns.Parameters:visibleOnly
: BooleanOptional. Pass as true to only include visible columns.
Returns:Number
ColumnModel getColumnHeader( Number col
)
+ :
+ StringReturns the header for the specified column.Returns the header for the specified column.Parameters:col
: NumberThe column index
Returns:String
ColumnModel getColumnId( Number index
)
+ :
+ StringReturns the id of the column at the specified index.Returns the id of the column at the specified index.Parameters:index
: NumberThe column index
Returns:String
the id
ColumnModel getColumnTooltip( Number col
)
+ :
+ StringReturns the tooltip for the specified column.Returns the tooltip for the specified column.Parameters:col
: NumberThe column index
Returns:String
ColumnModel getColumnWidth( Number col
)
+ :
+ NumberReturns the width for the specified column.Returns the width for the specified column.Parameters:col
: NumberThe column index
Returns:Number
ColumnModel getColumnsBy( Function fn
, [Object scope
] )
+ :
+ ArrayReturns the column configs that return true by the passed function that is called
+with (columnConfig, index)
+// retur...Returns the column configs that return true by the passed function that is called
+with (columnConfig, index)
+// returns an array of column config objects for all hidden columns
+var columns = grid.getColumnModel().getColumnsBy(function(c){
+ return c.hidden;
+});
Parameters:fn
: FunctionA function which, when passed a Column object, must
+return true
if the column is to be included in the returned Array.scope
: Object(optional) The scope (this
reference) in which the function
+is executed. Defaults to this ColumnModel.
Returns:Array
result
ColumnModel getDataIndex( Number col
)
+ :
+ StringReturns the dataIndex for the specified column.
+// Get field name for the column
+var fieldName = grid.getColumnModel(...Returns the dataIndex for the specified column.
+// Get field name for the column
+var fieldName = grid.getColumnModel().getDataIndex(columnIndex);
Parameters:col
: NumberThe column index
Returns:String
The column's dataIndex
ColumnModel getIndexById( String id
)
+ :
+ NumberReturns the index for a specified column id.Returns the index for a specified column id.Parameters:id
: StringThe column id
Returns:Number
the index, or -1 if not found
ColumnModel getRenderer( Number col
)
+ :
+ FunctionReturns the rendering (formatting) function defined for the column.Returns the rendering (formatting) function defined for the column.Parameters:col
: NumberThe column index.
Returns:Function
The function used to render the cell. See {@link #setRenderer}.
ColumnModel getTotalWidth( Boolean includeHidden
)
+ :
+ NumberReturns the total width of all columns.Returns the total width of all columns.Parameters:includeHidden
: BooleanTrue to include hidden column widths
Returns:Number
ColumnModel hasListener( String eventName
)
+ :
+ BooleanChecks to see if this object has any listeners for a specified eventChecks to see if this object has any listeners for a specified eventParameters:eventName
: StringThe name of the event to check for
Returns:Boolean
True if the event is being listened for, else false
Observable isCellEditable( Number colIndex
, Number rowIndex
)
+ :
+ BooleanReturns true if the cell is editable.
+var store = new Ext.data.Store({...});
+var colModel = new Ext.grid.ColumnModel(...Returns true if the cell is editable.
+var store = new Ext.data.Store({...});
+var colModel = new Ext.grid.ColumnModel({
+ columns: [...],
+ isCellEditable: function(col, row) {
+ var record = store.getAt(row);
+ if (record.get('readonly')) { // replace with your condition
+ return false;
+ }
+ return Ext.grid.ColumnModel.prototype.isCellEditable.call(this, col, row);
+ }
+});
+var grid = new Ext.grid.GridPanel({
+ store: store,
+ colModel: colModel,
+ ...
+});
Parameters:colIndex
: NumberThe column indexrowIndex
: NumberThe row index
Returns:Boolean
ColumnModel isFixed( Number colIndex
)
+ :
+ BooleanReturns true if the column is fixed,
+false otherwise.Returns true if the column is fixed
,
+false otherwise.Parameters:colIndex
: NumberThe column index
Returns:Boolean
ColumnModel isHidden( Number colIndex
)
+ :
+ BooleanReturns true if the column is hidden,
+false otherwise.Returns true if the column is hidden
,
+false otherwise.Parameters:colIndex
: NumberThe column index
Returns:Boolean
ColumnModel isMenuDisabled( Number col
)
+ :
+ BooleanReturns true if the specified column menu is disabled.Returns true if the specified column menu is disabled.Parameters:col
: NumberThe column index
Returns:Boolean
ColumnModel isResizable()
+ :
+ BooleanReturns true if the column can be resizedReturns true if the column can be resizedParameters:- None.
Returns:Boolean
ColumnModel isSortable( Number col
)
+ :
+ BooleanReturns true if the specified column is sortable.Returns true if the specified column is sortable.Parameters:col
: NumberThe column index
Returns:Boolean
ColumnModel moveColumn( Number oldIndex
, Number newIndex
)
+ :
+ voidMoves a column from one position to another.Moves a column from one position to another.Parameters:oldIndex
: NumberThe index of the column to move.newIndex
: NumberThe position at which to reinsert the coolumn.
Returns:- void
ColumnModel on( String eventName
, Function handler
, [Object scope
], [Object options
] )
+ :
+ voidAppends an event handler to this object (shorthand for addListener.)Appends an event handler to this object (shorthand for addListener.)Parameters:eventName
: StringThe type of event to listen forhandler
: FunctionThe method the event invokesscope
: Object(optional) The scope (this
reference) in which the handler function is executed.
+If omitted, defaults to the object which fired the event.options
: Object(optional) An object containing handler configuration.
Returns:- void
Observable purgeListeners()
+ :
+ voidRemoves all listeners for this objectRemoves all listeners for this objectParameters:- None.
Returns:- void
Observable relayEvents( Object o
, Array events
)
+ :
+ voidRelays selected events from the specified Observable as if the events were fired by this.Relays selected events from the specified Observable as if the events were fired by this.Parameters:o
: ObjectThe Observable whose events this object is to relay.events
: ArrayArray of event names to relay.
Returns:- void
Observable removeListener( String eventName
, Function handler
, [Object scope
] )
+ :
+ voidRemoves an event handler.Removes an event handler.Parameters:eventName
: StringThe type of event the handler was associated with.handler
: FunctionThe handler to remove. This must be a reference to the function passed into the addListener call.scope
: Object(optional) The scope originally specified for the handler.
Returns:- void
Observable resumeEvents()
+ :
+ voidResume firing events. (see suspendEvents)
+If events were suspended using the queueSuspended parameter, then all
+event...Resume firing events. (see suspendEvents)
+If events were suspended using the queueSuspended parameter, then all
+events fired during event suspension will be sent to any listeners now.Parameters:- None.
Returns:- void
Observable setColumnHeader( Number col
, String header
)
+ :
+ voidSets the header for a column.Sets the header for a column.Parameters:col
: NumberThe column indexheader
: StringThe new header
Returns:- void
ColumnModel setColumnTooltip( Number col
, String tooltip
)
+ :
+ voidSets the tooltip for a column.Sets the tooltip for a column.Parameters:col
: NumberThe column indextooltip
: StringThe new tooltip
Returns:- void
ColumnModel setColumnWidth( Number col
, Number width
, Boolean suppressEvent
)
+ :
+ voidSets the width for a column.Sets the width for a column.Parameters:col
: NumberThe column indexwidth
: NumberThe new widthsuppressEvent
: BooleanTrue to suppress firing the widthchange
+event. Defaults to false.
Returns:- void
ColumnModel setConfig( Array config
, Boolean initial
)
+ :
+ voidReconfigures this column model according to the passed Array of column definition objects.
+For a description of the i...Reconfigures this column model according to the passed Array of column definition objects.
+For a description of the individual properties of a column definition object, see the
+Config Options.
+Causes the configchange event to be fired. A GridPanel
+using this ColumnModel will listen for this event and refresh its UI automatically.
Parameters:config
: ArrayArray of Column definition objects.initial
: BooleanSpecify true to bypass cleanup which deletes the totalWidth
+and destroys existing editors.
Returns:- void
ColumnModel setDataIndex( Number col
, String dataIndex
)
+ :
+ voidSets the dataIndex for a column.Sets the dataIndex for a column.Parameters:col
: NumberThe column indexdataIndex
: StringThe new dataIndex
Returns:- void
ColumnModel setEditable( Number col
, Boolean editable
)
+ :
+ voidSets if a column is editable.Sets if a column is editable.Parameters:col
: NumberThe column indexeditable
: BooleanTrue if the column is editable
Returns:- void
ColumnModel setEditor( Number col
, Object editor
)
+ :
+ voidSets the editor for a column and destroys the prior editor.Sets the editor for a column and destroys the prior editor.Parameters:col
: NumberThe column indexeditor
: ObjectThe editor object
Returns:- void
ColumnModel setHidden( Number colIndex
, Boolean hidden
)
+ :
+ voidSets if a column is hidden.
+myGrid.getColumnModel().setHidden(0, true); // hide column 0 (0 = the first column).Sets if a column is hidden.
+myGrid.getColumnModel().setHidden(0, true); // hide column 0 (0 = the first column).
Parameters:colIndex
: NumberThe column indexhidden
: BooleanTrue if the column is hidden
Returns:- void
ColumnModel setRenderer( Number col
, Function fn
)
+ :
+ voidSets the rendering (formatting) function for a column. See Ext.util.Format for some
+default formatting functions.Sets the rendering (formatting) function for a column. See Ext.util.Format for some
+default formatting functions.Parameters:col
: NumberThe column indexfn
: FunctionThe function to use to process the cell's raw data
to return HTML markup for the grid view. The render function is called with
the following parameters:
- value : Object
The data value for the cell.
@@ -1096,148 +364,27 @@ the following parameters:
- css : String
A CSS class name to add to the cell's TD element.
- attr : String
An HTML attribute definition string to apply to the data container element within the table cell
(e.g. 'style="color:red;"').
-- record : Ext.data.record
The Ext.data.Record from which the data was extracted.
+- record : Ext.data.record
The Ext.data.Record from which the data was extracted.
- rowIndex : Number
Row index
- colIndex : Number
Column index
-- store : Ext.data.Store
The Ext.data.Store object from which the Record was extracted.
- Returns:
-
- void
-
-
-
-
-
- ColumnModel
-
-
-
-
-
- suspendEvents() : void
- Suspend the firing of all events. (see resumeEvents)
-
- Suspend the firing of all events. (see resumeEvents)
- Parameters:
- - None.
- Returns:
-
- void
-
-
-
-
-
- Observable
-
-
-
-
-
- un( String eventName
, Function handler
, [Object scope
] ) : void
- Removes a listener (shorthand for removeListener)
-
- Removes a listener (shorthand for removeListener)
- Parameters:
- eventName
: StringThe type of event to listen forhandler
: FunctionThe handler to removescope
: Object(optional) The scope (this object) for the handler
- Returns:
-
- void
-
-
-
-
-
- Observable
-
-
-
- Public Events
-
\ No newline at end of file
+store : Ext.data.StoreThe Ext.data.Store object from which the Record was extracted.
Returns:- void
ColumnModel suspendEvents( Boolean queueSuspended
)
+ :
+ voidSuspend the firing of all events. (see resumeEvents)Suspend the firing of all events. (see resumeEvents)Parameters:queueSuspended
: BooleanPass as true to queue up suspended events to be fired
+after the resumeEvents call instead of discarding all suspended events;
Returns:- void
Observable un( String eventName
, Function handler
, [Object scope
] )
+ :
+ voidRemoves an event handler (shorthand for removeListener.)Removes an event handler (shorthand for removeListener.)Parameters:eventName
: StringThe type of event the handler was associated with.handler
: FunctionThe handler to remove. This must be a reference to the function passed into the addListener call.scope
: Object(optional) The scope originally specified for the handler.
Returns:- void
Observable
Public Events
Event Defined By columnmoved :
+ ( ColumnModel this
, Number oldIndex
, Number newIndex
)
+ Fires when a column is moved.Fires when a column is moved.Listeners will be called with the following arguments:this
: ColumnModeloldIndex
: NumbernewIndex
: Number
ColumnModel configchange :
+ ( ColumnModel this
)
+ Fires when the configuration is changedFires when the configuration is changedListeners will be called with the following arguments:this
: ColumnModel
ColumnModel headerchange :
+ ( ColumnModel this
, Number columnIndex
, String newText
)
+ Fires when the text of a header changes.Fires when the text of a header changes.Listeners will be called with the following arguments:this
: ColumnModelcolumnIndex
: NumberThe column indexnewText
: StringThe new header text
ColumnModel hiddenchange :
+ ( ColumnModel this
, Number columnIndex
, Boolean hidden
)
+ Fires when a column is hidden or "unhidden".Fires when a column is hidden or "unhidden".Listeners will be called with the following arguments:this
: ColumnModelcolumnIndex
: NumberThe column indexhidden
: Booleantrue if hidden, false otherwise
ColumnModel widthchange :
+ ( ColumnModel this
, Number columnIndex
, Number newWidth
)
+ Fires when the width of a column is programmaticially changed using
+setColumnWidth.
+Note internal resizing suppresses...Fires when the width of a column is programmaticially changed using
+setColumnWidth
.
+Note internal resizing suppresses the event from firing. See also
+Ext.grid.GridPanel.columnresize
.Listeners will be called with the following arguments:this
: ColumnModelcolumnIndex
: NumberThe column indexnewWidth
: NumberThe new width
ColumnModel
\ No newline at end of file