- |
-
-
- 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 for handler : FunctionThe method the event invokes scope : 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
+model of a Grid is held in an Ext.data.Store. Config Options|
| autoFill : BooleanDefaults to false. Specify true to have the column widths re-proportioned
+when the grid is initially rendered. The
+... Defaults to false. Specify true to have the column widths re-proportioned
+when the grid is initially rendered. The
+ initially configured width of each column will be adjusted
+to fit the grid width and prevent horizontal scrolling. If columns are later resized (manually
+or programmatically), the other columns in the grid will not be resized to fit the grid width.
+See forceFit also. | GridView | | cellSelector : String The selector used to find cells internally (defaults to 'td.x-grid3-cell') | GridView | | cellSelectorDepth : Number The number of levels to search for cells in event delegation (defaults to 4) | GridView | | columnsText : String The text displayed in the 'Columns' menu item (defaults to 'Columns') | GridView | | deferEmptyText : BooleanTrue to defer emptyText being applied until the store's
+first load (defaults to true). | GridView | | emptyText : StringDefault text (html tags are accepted) to display in the grid body when no rows
+are available (defaults to ''). This v... Default text (html tags are accepted) to display in the grid body when no rows
+are available (defaults to ''). This value will be used to update the mainBody:
+ this.mainBody.update('<div class="x-grid-empty">' + this.emptyText + '</div>');
| GridView | | enableRowBody : BooleanTrue to add a second TR element per row that can be used to provide a row body
+that spans beneath the data row. Use ... True to add a second TR element per row that can be used to provide a row body
+that spans beneath the data row. Use the getRowClass method's rowParams config to customize the row body. | GridView | | forceFit : BooleanDefaults to false. Specify true to have the column widths re-proportioned
+at all times.
+The initially configured wid... Defaults to false. Specify true to have the column widths re-proportioned
+at all times.
+ The initially configured width of each
+column will be adjusted to fit the grid width and prevent horizontal scrolling. If columns are
+later resized (manually or programmatically), the other columns in the grid will be resized
+to fit the grid width.
+ Columns which are configured with fixed: true are omitted from being resized.
+ See autoFill. | GridView | | headerMenuOpenCls : String The CSS class to add to the header cell when its menu is visible. Defaults to 'x-grid3-hd-menu-open' | GridView | | headersDisabled : BooleanTrue to disable the grid column headers (defaults to false).
+Use the ColumnModel menuDisabled
+config to disable the m... True to disable the grid column headers (defaults to false).
+Use the ColumnModel menuDisabled
+config to disable the menu for individual columns. While this config is true the
+following will be disabled:
+- clicking on header to sort
+- the trigger to reveal the menu.
+ | GridView | | 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);
+ }
+ });
+ },
+
+ 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 | | markDirty : Boolean True to show the dirty cell indicator when a cell has been modified. Defaults to true. | GridView | | rowBodySelector : String The selector used to find row bodies internally (defaults to 'div.x-grid3-row') | GridView | | rowBodySelectorDepth : Number The number of levels to search for row bodies in event delegation (defaults to 10) | GridView | | rowOverCls : String The CSS class added to each row when it is hovered over. Defaults to 'x-grid3-row-over' | GridView | | rowSelector : String The selector used to find rows internally (defaults to 'div.x-grid3-row') | GridView | | rowSelectorDepth : Number The number of levels to search for rows in event delegation (defaults to 10) | GridView | | scrollOffset : NumberThe amount of space to reserve for the vertical scrollbar
+(defaults to undefined). If an explicit value isn't specifi... The amount of space to reserve for the vertical scrollbar
+(defaults to undefined). If an explicit value isn't specified, this will be automatically
+calculated. | GridView | | selectedRowClass : StringThe CSS class applied to a selected row (defaults to 'x-grid3-row-selected'). An
+example overriding the default styli... The CSS class applied to a selected row (defaults to 'x-grid3-row-selected'). An
+example overriding the default styling:
+ .x-grid3-row-selected {background-color: yellow;}
+Note that this only controls the row, and will not do anything for the text inside it. To style inner
+facets (like text) use something like:
+ .x-grid3-row-selected .x-grid3-cell-inner {
+ color: #FFCC00;
+ }
| GridView | | sortAscText : String The text displayed in the 'Sort Ascending' menu item (defaults to 'Sort Ascending') | GridView | | sortClasses : Array The CSS classes applied to a header when it is sorted. (defaults to ['sort-asc', 'sort-desc']) | GridView | | sortDescText : String The text displayed in the 'Sort Descending' menu item (defaults to 'Sort Descending') | GridView |
Public Properties|
| Ext.Template : masterTpl The master template to use when rendering the GridView. Has a default template | GridView | | bodyTpl : Ext.Template The template to use when rendering the body. Has a default template | GridView | | cellTpl : Ext.Template The template to use to render each cell. Has a default template | GridView | | dragZone : Ext.grid.GridDragZoneA customized implementation of a DragZone which provides default implementations
+of the template methods of DragZone ... A customized implementation of a DragZone which provides default implementations
+of the template methods of DragZone to enable dragging of the selected rows of a GridPanel.
+See Ext.grid.GridDragZone for details.
+ This will only be present:
+- if the owning GridPanel was configured with enableDragDrop: true.
+- after the owning GridPanel has been rendered.
+ | GridView | | headerTpl : Ext.Template The template to use when rendering headers. Has a default template | GridView | | mainBody : Ext.ElementRead-only. The GridView's body Element which encapsulates all rows in the Grid.
+This Element is only available after ... Read-only. The GridView's body Element which encapsulates all rows in the Grid.
+This Element is only available after the GridPanel has been rendered. | GridView |
Public Methods|
| GridView( Object config )
+ | GridView | | 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. | 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 : Object
The scope (this reference) in which the handler function is executed.
+If omitted, defaults to the object which fired the event.
+- 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
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 : Observable
Only 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:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- findRow( Element el ) : The
- Return the HtmlElement representing the grid row which contains the passed element.
-
- Return the HtmlElement representing the grid row which contains the passed element.
- Parameters:
- el : ElementThe target element
- Returns:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- findRowIndex( Element el ) : The
- Return the index of the grid row which contains the passed element.
-
- Return the index of the grid row which contains the passed element.
- Parameters:
- el : ElementThe target element
- Returns:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- 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:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- focusCell( Number row , Number col ) : void
- Focuses the specified cell.
-
- Focuses the specified cell.
- Parameters:
- row : NumberThe row index col : NumberThe column index
- Returns:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- focusRow( Number row ) : void
- Focuses the specified row.
-
- Focuses the specified row.
- Parameters:
- row : NumberThe row index
- Returns:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- getCell( Number row , Number col ) : HtmlElement
- Returns the grid's <TD> HtmlElement at the specified coordinates.
-
- Returns the grid's <TD> HtmlElement at the specified coordinates.
- Parameters:
-
- Returns:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- getHeaderCell( Number index ) : HtmlElement
- Return the <TD> HtmlElement which represents the Grid's header cell for the specified column index.
-
- Return the <TD> HtmlElement which represents the Grid's header cell for the specified column index.
- Parameters:
- index : NumberThe column index
- Returns:
-
- HtmlElement The <TD> element.
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- getRow( Number index ) : HtmlElement
- Return the <TR> HtmlElement which represents a Grid row for the specified index.
-
- Return the <TR> HtmlElement which represents a Grid row for the specified index.
- Parameters:
- index : NumberThe row index
- Returns:
-
- HtmlElement The <TR> element.
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- getRowClass( Record record , Number index , Object rowParams , Store store ) : String
- Override this function to apply custom CSS classes to rows during rendering. You can also supply custom
-parameters t...
-
- Override this function to apply custom CSS classes to rows during rendering. You can also supply custom
+ myGridPanel.on({
+'click' : this.onClick,
+'mouseover' : this.onMouseOver,
+'mouseout' : this.onMouseOut,
+ scope: this
+});
Returns: | Observable | | 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');
+ }
+ }
+});
| Observable | | findCellIndex( HTMLElement el )
+ :
+ NumberReturn the index of the grid column which contains the passed HTMLElement.
+See also findRowIndex Return the index of the grid column which contains the passed HTMLElement.
+See also findRowIndexParameters:el : HTMLElementThe target element Returns: | GridView | | findRow( HTMLElement el )
+ :
+ HTMLElementReturn the HtmlElement representing the grid row which contains the passed element. Return the HtmlElement representing the grid row which contains the passed element. Parameters:el : HTMLElementThe target HTMLElement Returns: | GridView | | findRowBody( HTMLElement el )
+ :
+ HTMLElementReturn the HtmlElement representing the grid row body which contains the passed element. Return the HtmlElement representing the grid row body which contains the passed element. Parameters:el : HTMLElementThe target HTMLElement Returns: | GridView | | findRowIndex( HTMLElement el )
+ :
+ NumberReturn the index of the grid row which contains the passed HTMLElement.
+See also findCellIndex Return the index of the grid row which contains the passed HTMLElement.
+See also findCellIndexParameters:el : HTMLElementThe target HTMLElement Returns: | GridView | | 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... | Observable | | focusCell( Number row , Number col )
+ :
+ voidFocuses the specified cell. Focuses the specified cell. Parameters:row : NumberThe row index col : NumberThe column index Returns: | GridView | | focusRow( Number row )
+ :
+ voidFocuses the specified row. Focuses the specified row. Parameters:row : NumberThe row index Returns: | GridView | | getCell( Number row , Number col )
+ :
+ HtmlElementReturns the grid's <td> HtmlElement at the specified coordinates. Returns the grid's <td> HtmlElement at the specified coordinates. | GridView | | getGridInnerWidth()
+ :
+ NumberReturns the total internal width available to the grid, taking the scrollbar into account Returns the total internal width available to the grid, taking the scrollbar into account | GridView | | getHeaderCell( Number index )
+ :
+ HtmlElementReturn the <td> HtmlElement which represents the Grid's header cell for the specified column index. Return the <td> HtmlElement which represents the Grid's header cell for the specified column index. Parameters:index : NumberThe column index Returns:HtmlElement The td element.
| GridView | | getRow( Number index )
+ :
+ HtmlElementReturn the <div> HtmlElement which represents a Grid row for the specified index. Return the <div> HtmlElement which represents a Grid row for the specified index. Parameters:index : NumberThe row index Returns:HtmlElement The div element.
| GridView | | getRowClass( Record record , Number index , Object rowParams , Store store )
+ :
+ StringOverride this function to apply custom CSS classes to rows during rendering. You can also supply custom
+parameters t... Override this function to apply custom CSS classes to rows during rendering. You can also supply custom
parameters to the row template for the current row to customize how it is rendered using the rowParams
parameter. This function should return the CSS class name (or empty string '' for none) that will be added
to the row's wrapping div. To apply multiple class names, simply return them space-delimited within the string
-(e.g., 'my-class another-class').
- Parameters:
- record : Recordindex : NumberThe row index rowParams : ObjectA config object that is passed to the row template during rendering that allows
-customization of various aspects of a body row, if applicable. Note that this object will only be applied if
- enableRowBody = true, otherwise it will be ignored. The object may contain any of these properties:
-body : String An HTML fragment to be rendered as the cell's body content (defaults to '').
-bodyStyle : String A CSS style string that will be applied to the row's TR style attribute (defaults to '').
-cols : Number The column count to apply to the body row's TD colspan attribute (defaults to the current
-column count of the grid).
- store : Store
- Returns:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- 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:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- 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 for handler : FunctionThe method the event invokes scope : Object(optional) The scope in which to execute the handler
-function. The handler function's "this" context. options : Object(optional)
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- purgeListeners() : void
- Removes all listeners for this object
-
- Removes all listeners for this object
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- refresh( [Boolean headersToo ] ) : void
- Refreshs the grid UI
-
- Refreshs the grid UI
- Parameters:
-
- Returns:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- 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:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- removeListener( String eventName , Function handler , [Object scope ] ) : void
- Removes a listener
-
- Removes a listener
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- resumeEvents() : void
-
-
- Resume firing events. (see suspendEvents)
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- scrollToTop() : void
- Scrolls the grid to the top
-
- Scrolls the grid to the top
- Parameters:
-
- Returns:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- suspendEvents() : void
-
-
- Suspend the firing of all events. (see resumeEvents)
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- un( String eventName , Function handler , [Object scope ] ) : void
- Removes a listener (shorthand for removeListener)
-
- Removes a listener (shorthand for removeListener)
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
-
- Public Events
-
-
-
-
-
-
- |
-
-
- beforerefresh : ( Ext.grid.GridView view )
- Internal UI Event. Fired before the view is refreshed.
-
- Internal UI Event. Fired before the view is refreshed.
- Listeners will be called with the following arguments:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- beforerowremoved : ( Ext.grid.GridView view , Number rowIndex , Ext.data.Record record )
- Internal UI Event. Fired before a row is removed.
-
- Internal UI Event. Fired before a row is removed.
- Listeners will be called with the following arguments:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- beforerowsinserted : ( Ext.grid.GridView view , Number firstRow , Number lastRow )
- Internal UI Event. Fired before rows are inserted.
-
- Internal UI Event. Fired before rows are inserted.
- Listeners will be called with the following arguments:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- refresh : ( Ext.grid.GridView view )
- Internal UI Event. Fired after the GridView's body has been refreshed.
-
- Internal UI Event. Fired after the GridView's body has been refreshed.
- Listeners will be called with the following arguments:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- rowremoved : ( Ext.grid.GridView view , Number rowIndex , Ext.data.Record record )
- Internal UI Event. Fired after a row is removed.
-
- Internal UI Event. Fired after a row is removed.
- Listeners will be called with the following arguments:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- rowsinserted : ( Ext.grid.GridView view , Number firstRow , Number lastRow )
- Internal UI Event. Fired after rows are inserted.
-
- Internal UI Event. Fired after rows are inserted.
- Listeners will be called with the following arguments:
-
-
-
-
- |
- GridView |
-
-
- |
-
-
- rowupdated : ( Ext.grid.GridView view , Number firstRow , Ext.data.record record )
- Internal UI Event. Fired after a row has been updated.
-
- Internal UI Event. Fired after a row has been updated.
- Listeners will be called with the following arguments:
-
-
-
-
- |
- GridView |
-
-
-
-
\ No newline at end of file
+(e.g., 'my-class another-class'). Example usage:
+ viewConfig: {
+ forceFit: true,
+ showPreview: true, // custom property
+ enableRowBody: true, // required to create a second, full-width row to show expanded Record data
+ getRowClass: function(record, rowIndex, rp, ds){ // rp = rowParams
+ if(this.showPreview){
+ rp.body = '<p>'+record.data.excerpt+'</p>';
+ return 'x-grid3-row-expanded';
+ }
+ return 'x-grid3-row-collapsed';
+ }
+},
Parameters:record : Recordindex : NumberThe row index. rowParams : ObjectA config object that is passed to the row template during rendering that allows
+customization of various aspects of a grid row.
+ If enableRowBody is configured true, then the following properties may be set
+by this function, and will be used to render a full-width expansion row below each grid row:
+
+The following property will be passed in, and may be appended to:
+ store : Store Returns: | GridView |