4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-grid-column-Column'>/**
19 </span> * This class specifies the definition for a column inside a {@link Ext.grid.Panel}. It encompasses
20 * both the grid header configuration as well as displaying data within the grid itself. If the
21 * {@link #columns} configuration is specified, this column will become a column group and can
22 * contain other columns inside. In general, this class will not be created directly, rather
23 * an array of column configurations will be passed to the grid:
26 * Ext.create('Ext.data.Store', {
27 * storeId:'employeeStore',
28 * fields:['firstname', 'lastname', 'senority', 'dep', 'hired'],
30 * {firstname:"Michael", lastname:"Scott", senority:7, dep:"Manangement", hired:"01/10/2004"},
31 * {firstname:"Dwight", lastname:"Schrute", senority:2, dep:"Sales", hired:"04/01/2004"},
32 * {firstname:"Jim", lastname:"Halpert", senority:3, dep:"Sales", hired:"02/22/2006"},
33 * {firstname:"Kevin", lastname:"Malone", senority:4, dep:"Accounting", hired:"06/10/2007"},
34 * {firstname:"Angela", lastname:"Martin", senority:5, dep:"Accounting", hired:"10/21/2008"}
38 * Ext.create('Ext.grid.Panel', {
39 * title: 'Column Demo',
40 * store: Ext.data.StoreManager.lookup('employeeStore'),
42 * {text: 'First Name', dataIndex:'firstname'},
43 * {text: 'Last Name', dataIndex:'lastname'},
44 * {text: 'Hired Month', dataIndex:'hired', xtype:'datecolumn', format:'M'},
45 * {text: 'Department (Yrs)', xtype:'templatecolumn', tpl:'{dep} ({senority})'}
48 * renderTo: Ext.getBody()
51 * # Convenience Subclasses
53 * There are several column subclasses that provide default rendering for various data types
55 * - {@link Ext.grid.column.Action}: Renders icons that can respond to click events inline
56 * - {@link Ext.grid.column.Boolean}: Renders for boolean values
57 * - {@link Ext.grid.column.Date}: Renders for date values
58 * - {@link Ext.grid.column.Number}: Renders for numeric values
59 * - {@link Ext.grid.column.Template}: Renders a value using an {@link Ext.XTemplate} using the record data
63 * The columns are laid out by a {@link Ext.layout.container.HBox} layout, so a column can either
64 * be given an explicit width value or a flex configuration. If no width is specified the grid will
65 * automatically the size the column to 100px. For column groups, the size is calculated by measuring
66 * the width of the child columns, so a width option should not be specified in that case.
70 * - {@link #text}: Sets the header text for the column
71 * - {@link #sortable}: Specifies whether the column can be sorted by clicking the header or using the column menu
72 * - {@link #hideable}: Specifies whether the column can be hidden using the column menu
73 * - {@link #menuDisabled}: Disables the column header menu
74 * - {@link #draggable}: Specifies whether the column header can be reordered by dragging
75 * - {@link #groupable}: Specifies whether the grid can be grouped by the column dataIndex. See also {@link Ext.grid.feature.Grouping}
79 * - {@link #dataIndex}: The dataIndex is the field in the underlying {@link Ext.data.Store} to use as the value for the column.
80 * - {@link #renderer}: Allows the underlying store value to be transformed before being displayed in the grid
82 Ext.define('Ext.grid.column.Column', {
83 extend: 'Ext.grid.header.Container',
84 alias: 'widget.gridcolumn',
85 requires: ['Ext.util.KeyNav'],
86 alternateClassName: 'Ext.grid.Column',
88 baseCls: Ext.baseCSSPrefix + 'column-header ' + Ext.baseCSSPrefix + 'unselectable',
90 // Not the standard, automatically applied overCls because we must filter out overs of child headers.
91 hoverCls: Ext.baseCSSPrefix + 'column-header-over',
97 possibleSortStates: ['ASC', 'DESC'],
100 '<div id="{id}-titleContainer" class="' + Ext.baseCSSPrefix + 'column-header-inner">' +
101 '<span id="{id}-textEl" class="' + Ext.baseCSSPrefix + 'column-header-text">' +
104 '<tpl if="!values.menuDisabled">'+
105 '<div id="{id}-triggerEl" class="' + Ext.baseCSSPrefix + 'column-header-trigger"></div>'+
109 <span id='Ext-grid-column-Column-cfg-columns'> /**
110 </span> * @cfg {Object[]} columns
111 * An optional array of sub-column definitions. This column becomes a group, and houses the columns defined in the
114 * Group columns may not be sortable. But they may be hideable and moveable. And you may move headers into and out
115 * of a group. Note that if all sub columns are dragged out of a group, the group is destroyed.
118 <span id='Ext-grid-column-Column-cfg-dataIndex'> /**
119 </span> * @cfg {String} dataIndex
120 * The name of the field in the grid's {@link Ext.data.Store}'s {@link Ext.data.Model} definition from
121 * which to draw the column's value. **Required.**
125 <span id='Ext-grid-column-Column-cfg-text'> /**
126 </span> * @cfg {String} text
127 * The header text to be used as innerHTML (html tags are accepted) to display in the Grid.
128 * **Note**: to have a clickable header with no text displayed you can use the default of `&#160;` aka `&nbsp;`.
132 <span id='Ext-grid-column-Column-cfg-sortable'> /**
133 </span> * @cfg {Boolean} sortable
134 * False to disable sorting of this column. Whether local/remote sorting is used is specified in
135 * `{@link Ext.data.Store#remoteSort}`. Defaults to true.
139 <span id='Ext-grid-column-Column-cfg-groupable'> /**
140 </span> * @cfg {Boolean} groupable
141 * If the grid uses a {@link Ext.grid.feature.Grouping}, this option may be used to disable the header menu
142 * item to group by the column selected. By default, the header menu group option is enabled. Set to false to
143 * disable (but still show) the group option in the header menu for the column.
146 <span id='Ext-grid-column-Column-cfg-fixed'> /**
147 </span> * @cfg {Boolean} fixed
149 * True to prevent the column from being resizable.
152 <span id='Ext-grid-column-Column-cfg-resizable'> /**
153 </span> * @cfg {Boolean} resizable
154 * Set to <code>false</code> to prevent the column from being resizable. Defaults to <code>true</code>
157 <span id='Ext-grid-column-Column-cfg-hideable'> /**
158 </span> * @cfg {Boolean} hideable
159 * False to prevent the user from hiding this column. Defaults to true.
163 <span id='Ext-grid-column-Column-cfg-menuDisabled'> /**
164 </span> * @cfg {Boolean} menuDisabled
165 * True to disable the column header menu containing sort/hide options. Defaults to false.
169 <span id='Ext-grid-column-Column-cfg-renderer'> /**
170 </span> * @cfg {Function} renderer
171 * A renderer is an 'interceptor' method which can be used transform data (value, appearance, etc.)
172 * before it is rendered. Example:
175 * renderer: function(value){
179 * return value + ' people';
183 * @cfg {Object} renderer.value The data value for the current cell
184 * @cfg {Object} renderer.metaData A collection of metadata about the current cell; can be used or modified
185 * by the renderer. Recognized properties are: tdCls, tdAttr, and style.
186 * @cfg {Ext.data.Model} renderer.record The record for the current row
187 * @cfg {Number} renderer.rowIndex The index of the current row
188 * @cfg {Number} renderer.colIndex The index of the current column
189 * @cfg {Ext.data.Store} renderer.store The data store
190 * @cfg {Ext.view.View} renderer.view The current view
191 * @cfg {String} renderer.return The HTML string to be rendered.
195 <span id='Ext-grid-column-Column-cfg-align'> /**
196 </span> * @cfg {String} align
197 * Sets the alignment of the header and rendered columns. Defaults to 'left'.
201 <span id='Ext-grid-column-Column-cfg-draggable'> /**
202 </span> * @cfg {Boolean} draggable
203 * False to disable drag-drop reordering of this column. Defaults to true.
207 // Header does not use the typical ComponentDraggable class and therefore we
208 // override this with an emptyFn. It is controlled at the HeaderDragZone.
209 initDraggable: Ext.emptyFn,
211 <span id='Ext-grid-column-Column-cfg-tdCls'> /**
212 </span> * @cfg {String} tdCls
213 * A CSS class names to apply to the table cells for this column.
216 <span id='Ext-grid-column-Column-cfg-editor'> /**
217 </span> * @cfg {Object/String} editor
218 * An optional xtype or config object for a {@link Ext.form.field.Field Field} to use for editing.
219 * Only applicable if the grid is using an {@link Ext.grid.plugin.Editing Editing} plugin.
222 <span id='Ext-grid-column-Column-cfg-field'> /**
223 </span> * @cfg {Object/String} field
224 * Alias for {@link #editor}.
225 * @deprecated 4.0.5 Use {@link #editor} instead.
228 <span id='Ext-grid-column-Column-property-triggerEl'> /**
229 </span> * @property {Ext.Element} triggerEl
230 * Element that acts as button for column header dropdown menu.
233 <span id='Ext-grid-column-Column-property-textEl'> /**
234 </span> * @property {Ext.Element} textEl
235 * Element that contains the text in column header.
238 <span id='Ext-grid-column-Column-property-isHeader'> /**
240 * Set in this class to identify, at runtime, instances which are not instances of the
241 * HeaderContainer base class, but are in fact, the subclass: Header.
245 initComponent: function() {
251 if (Ext.isDefined(me.header)) {
256 // Flexed Headers need to have a minWidth defined so that they can never be squeezed out of existence by the
257 // HeaderContainer's specialized Box layout, the ColumnLayout. The ColumnLayout's overridden calculateChildboxes
258 // method extends the available layout space to accommodate the "desiredWidth" of all the columns.
260 me.minWidth = me.minWidth || Ext.grid.plugin.HeaderResizer.prototype.minColWidth;
262 // Non-flexed Headers may never be squeezed in the event of a shortfall so
263 // always set their minWidth to their current width.
265 me.minWidth = me.width;
268 if (!me.triStateSort) {
269 me.possibleSortStates.length = 2;
272 // A group header; It contains items which are themselves Headers
273 if (Ext.isDefined(me.columns)) {
274 me.isGroupHeader = true;
278 Ext.Error.raise('Ext.grid.column.Column: Group header may not accept a dataIndex');
280 if ((me.width && me.width !== Ext.grid.header.Container.prototype.defaultWidth) || me.flex) {
281 Ext.Error.raise('Ext.grid.column.Column: Group header does not support setting explicit widths or flexs. The group header width is calculated by the sum of its children.');
285 // The headers become child items
286 me.items = me.columns;
291 // Acquire initial width from sub headers
292 for (i = 0, len = me.items.length; i < len; i++) {
295 me.width += item.width || Ext.grid.header.Container.prototype.defaultWidth;
299 Ext.Error.raise('Ext.grid.column.Column: items of a grouped header do not support flexed values. Each item must explicitly define its width.');
303 me.minWidth = me.width;
305 me.cls = (me.cls||'') + ' ' + Ext.baseCSSPrefix + 'group-header';
307 me.resizable = false;
311 me.addChildEls('titleContainer', 'triggerEl', 'textEl');
313 // Initialize as a HeaderContainer
314 me.callParent(arguments);
317 onAdd: function(childHeader) {
318 childHeader.isSubHeader = true;
319 childHeader.addCls(Ext.baseCSSPrefix + 'group-sub-header');
320 this.callParent(arguments);
323 onRemove: function(childHeader) {
324 childHeader.isSubHeader = false;
325 childHeader.removeCls(Ext.baseCSSPrefix + 'group-sub-header');
326 this.callParent(arguments);
329 initRenderData: function() {
332 Ext.applyIf(me.renderData, {
334 menuDisabled: me.menuDisabled
336 return me.callParent(arguments);
339 applyColumnState: function (state) {
341 defined = Ext.isDefined;
344 me.applyColumnsState(state.columns);
346 // Only state properties which were saved should be restored.
347 // (Only user-changed properties were saved by getState)
348 if (defined(state.hidden)) {
349 me.hidden = state.hidden;
351 if (defined(state.locked)) {
352 me.locked = state.locked;
354 if (defined(state.sortable)) {
355 me.sortable = state.sortable;
357 if (defined(state.width)) {
359 me.width = state.width;
360 } else if (defined(state.flex)) {
362 me.flex = state.flex;
366 getColumnState: function () {
373 me.savePropsToState(['hidden', 'sortable', 'locked', 'flex', 'width'], state);
375 if (me.isGroupHeader) {
376 me.items.each(function(column){
377 columns.push(column.getColumnState());
379 if (columns.length) {
380 state.columns = columns;
382 } else if (me.isSubHeader && me.ownerCt.hidden) {
383 // don't set hidden on the children so they can auto height
387 if ('width' in state) {
388 delete state.flex; // width wins
393 <span id='Ext-grid-column-Column-method-setText'> /**
394 </span> * Sets the header text for this Column.
395 * @param {String} text The header to display on this Column.
397 setText: function(text) {
400 this.textEl.update(text);
404 // Find the topmost HeaderContainer: An ancestor which is NOT a Header.
405 // Group Headers are themselves HeaderContainers
406 getOwnerHeaderCt: function() {
407 return this.up(':not([isHeader])');
410 <span id='Ext-grid-column-Column-method-getIndex'> /**
411 </span> * Returns the true grid column index associated with this column only if this column is a base level Column. If it
412 * is a group column, it returns `false`.
415 getIndex: function() {
416 return this.isGroupColumn ? false : this.getOwnerHeaderCt().getHeaderIndex(this);
419 onRender: function() {
421 grid = me.up('tablepanel');
423 // Disable the menu if there's nothing to show in the menu, ie:
424 // Column cannot be sorted, grouped or locked, and there are no grid columns which may be hidden
425 if (grid && (!me.sortable || grid.sortableColumns === false) && !me.groupable && !me.lockable && (grid.enableColumnHide === false || !me.getOwnerHeaderCt().getHideableColumns().length)) {
426 me.menuDisabled = true;
428 me.callParent(arguments);
431 afterRender: function() {
435 me.callParent(arguments);
437 el.addCls(Ext.baseCSSPrefix + 'column-header-align-' + me.align).addClsOnOver(me.overCls);
441 dblclick: me.onElDblClick,
445 // BrowserBug: Ie8 Strict Mode, this will break the focus for this browser,
446 // must be fixed when focus management will be implemented.
447 if (!Ext.isIE8 || !Ext.isStrict) {
448 me.mon(me.getFocusEl(), {
449 focus: me.onTitleMouseOver,
450 blur: me.onTitleMouseOut,
455 me.mon(me.titleContainer, {
456 mouseenter: me.onTitleMouseOver,
457 mouseleave: me.onTitleMouseOut,
461 me.keyNav = Ext.create('Ext.util.KeyNav', el, {
462 enter: me.onEnterKey,
468 <span id='Ext-grid-column-Column-method-setWidth'> /**
469 </span> * Sets the width of this Column.
470 * @param {Number} width New width.
472 setWidth: function(width, /* private - used internally */ doLayout) {
474 headerCt = me.ownerCt,
477 oldWidth = me.getWidth(),
481 if (width !== oldWidth) {
482 me.oldWidth = oldWidth;
484 // Non-flexed Headers may never be squeezed in the event of a shortfall so
485 // always set the minWidth to their current width.
486 me.minWidth = me.width = width;
488 // Bubble size changes upwards to group headers
489 if (headerCt.isGroupHeader) {
490 siblings = headerCt.items.items;
491 len = siblings.length;
493 for (i = 0; i < len; i++) {
494 sibling = siblings[i];
495 if (!sibling.hidden) {
496 groupWidth += (sibling === me) ? width : sibling.getWidth();
499 headerCt.setWidth(groupWidth, doLayout);
500 } else if (doLayout !== false) {
501 // Allow the owning Container to perform the sizing
507 afterComponentLayout: function(width, height) {
509 ownerHeaderCt = this.getOwnerHeaderCt();
511 me.callParent(arguments);
513 // Only changes at the base level inform the grid's HeaderContainer which will update the View
514 // Skip this if the width is null or undefined which will be the Box layout's initial pass through the child Components
515 // Skip this if it's the initial size setting in which case there is no ownerheaderCt yet - that is set afterRender
516 if (width && !me.isGroupHeader && ownerHeaderCt) {
517 ownerHeaderCt.onHeaderResize(me, width, true);
519 if (me.oldWidth && (width !== me.oldWidth)) {
520 ownerHeaderCt.fireEvent('columnresize', ownerHeaderCt, this, width);
526 // After the container has laid out and stretched, it calls this to correctly pad the inner to center the text vertically
527 // Total available header height must be passed to enable padding for inner elements to be calculated.
528 setPadding: function(headerHeight) {
530 lineHeight = Ext.util.TextMetrics.measure(me.textEl.dom, me.text).height;
532 // Top title containing element must stretch to match height of sibling group headers
533 if (!me.isGroupHeader) {
534 if (me.titleContainer.getHeight() < headerHeight) {
535 me.titleContainer.dom.style.height = headerHeight + 'px';
538 headerHeight = me.titleContainer.getViewSize().height;
540 // Vertically center the header text in potentially vertically stretched header
542 me.titleContainer.setStyle({
543 paddingTop: Math.max(((headerHeight - lineHeight) / 2), 0) + 'px'
547 // Only IE needs this
548 if (Ext.isIE && me.triggerEl) {
549 me.triggerEl.setHeight(headerHeight);
553 onDestroy: function() {
555 // force destroy on the textEl, IE reports a leak
556 Ext.destroy(me.textEl, me.keyNav);
558 me.callParent(arguments);
561 onTitleMouseOver: function() {
562 this.titleContainer.addCls(this.hoverCls);
565 onTitleMouseOut: function() {
566 this.titleContainer.removeCls(this.hoverCls);
569 onDownKey: function(e) {
570 if (this.triggerEl) {
571 this.onElClick(e, this.triggerEl.dom || this.el.dom);
575 onEnterKey: function(e) {
576 this.onElClick(e, this.el.dom);
579 <span id='Ext-grid-column-Column-method-onElDblClick'> /**
585 onElDblClick: function(e, t) {
587 ownerCt = me.ownerCt;
588 if (ownerCt && Ext.Array.indexOf(ownerCt.items, me) !== 0 && me.isOnLeftEdge(e) ) {
589 ownerCt.expandToFit(me.previousSibling('gridcolumn'));
593 onElClick: function(e, t) {
595 // The grid's docked HeaderContainer.
597 ownerHeaderCt = me.getOwnerHeaderCt();
599 if (ownerHeaderCt && !ownerHeaderCt.ddLock) {
600 // Firefox doesn't check the current target in a within check.
601 // Therefore we check the target directly and then within (ancestors)
602 if (me.triggerEl && (e.target === me.triggerEl.dom || t === me.triggerEl.dom || e.within(me.triggerEl))) {
603 ownerHeaderCt.onHeaderTriggerClick(me, e, t);
604 // if its not on the left hand edge, sort
605 } else if (e.getKey() || (!me.isOnLeftEdge(e) && !me.isOnRightEdge(e))) {
606 me.toggleSortState();
607 ownerHeaderCt.onHeaderClick(me, e, t);
612 <span id='Ext-grid-column-Column-method-processEvent'> /**
614 * Process UI events from the view. The owning TablePanel calls this method, relaying events from the TableView
615 * @param {String} type Event type, eg 'click'
616 * @param {Ext.view.Table} view TableView Component
617 * @param {HTMLElement} cell Cell HtmlElement the event took place within
618 * @param {Number} recordIndex Index of the associated Store Model (-1 if none)
619 * @param {Number} cellIndex Cell index within the row
620 * @param {Ext.EventObject} e Original event
622 processEvent: function(type, view, cell, recordIndex, cellIndex, e) {
623 return this.fireEvent.apply(this, arguments);
626 toggleSortState: function() {
632 idx = Ext.Array.indexOf(me.possibleSortStates, me.sortState);
634 nextIdx = (idx + 1) % me.possibleSortStates.length;
635 me.setSortState(me.possibleSortStates[nextIdx]);
639 doSort: function(state) {
640 var ds = this.up('tablepanel').store;
642 property: this.getSortParam(),
647 <span id='Ext-grid-column-Column-method-getSortParam'> /**
648 </span> * Returns the parameter to sort upon when sorting this header. By default this returns the dataIndex and will not
649 * need to be overriden in most cases.
652 getSortParam: function() {
653 return this.dataIndex;
656 //setSortState: function(state, updateUI) {
657 //setSortState: function(state, doSort) {
658 setSortState: function(state, skipClear, initial) {
660 colSortClsPrefix = Ext.baseCSSPrefix + 'column-header-sort-',
661 ascCls = colSortClsPrefix + 'ASC',
662 descCls = colSortClsPrefix + 'DESC',
663 nullCls = colSortClsPrefix + 'null',
664 ownerHeaderCt = me.getOwnerHeaderCt(),
665 oldSortState = me.sortState;
667 if (oldSortState !== state && me.getSortParam()) {
668 me.addCls(colSortClsPrefix + state);
669 // don't trigger a sort on the first time, we just want to update the UI
670 if (state && !initial) {
675 me.removeCls([ascCls, nullCls]);
678 me.removeCls([descCls, nullCls]);
681 me.removeCls([ascCls, descCls]);
684 if (ownerHeaderCt && !me.triStateSort && !skipClear) {
685 ownerHeaderCt.clearOtherSortStates(me);
687 me.sortState = state;
688 ownerHeaderCt.fireEvent('sortchange', ownerHeaderCt, me, state);
698 ownerHeaderCt = me.getOwnerHeaderCt();
700 // Hiding means setting to zero width, so cache the width
701 me.oldWidth = me.getWidth();
703 // Hiding a group header hides itself, and then informs the HeaderContainer about its sub headers (Suppressing header layout)
704 if (me.isGroupHeader) {
705 items = me.items.items;
706 me.callParent(arguments);
707 ownerHeaderCt.onHeaderHide(me);
708 for (i = 0, len = items.length; i < len; i++) {
709 items[i].hidden = true;
710 ownerHeaderCt.onHeaderHide(items[i], true);
715 // TODO: Work with Jamie to produce a scheme where we can show/hide/resize without triggering a layout cascade
716 lb = me.ownerCt.componentLayout.layoutBusy;
717 me.ownerCt.componentLayout.layoutBusy = true;
718 me.callParent(arguments);
719 me.ownerCt.componentLayout.layoutBusy = lb;
721 // Notify owning HeaderContainer
722 ownerHeaderCt.onHeaderHide(me);
724 if (me.ownerCt.isGroupHeader) {
725 // If we've just hidden the last header in a group, then hide the group
726 items = me.ownerCt.query('>:not([hidden])');
730 // Size the group down to accommodate fewer sub headers
732 for (i = 0, len = items.length; i < len; i++) {
733 newWidth += items[i].getWidth();
735 me.ownerCt.minWidth = newWidth;
736 me.ownerCt.setWidth(newWidth);
743 ownerCt = me.ownerCt,
744 ownerCtCompLayout = ownerCt.componentLayout,
745 ownerCtCompLayoutBusy = ownerCtCompLayout.layoutBusy,
746 ownerCtLayout = ownerCt.layout,
747 ownerCtLayoutBusy = ownerCtLayout.layoutBusy,
753 // TODO: Work with Jamie to produce a scheme where we can show/hide/resize without triggering a layout cascade
755 // Suspend our owner's layouts (both component and container):
756 ownerCtCompLayout.layoutBusy = ownerCtLayout.layoutBusy = true;
758 me.callParent(arguments);
760 ownerCtCompLayout.layoutBusy = ownerCtCompLayoutBusy;
761 ownerCtLayout.layoutBusy = ownerCtLayoutBusy;
763 // If a sub header, ensure that the group header is visible
764 if (me.isSubHeader) {
765 if (!ownerCt.isVisible()) {
770 // If we've just shown a group with all its sub headers hidden, then show all its sub headers
771 if (me.isGroupHeader && !me.query(':not([hidden])').length) {
772 items = me.query('>*');
773 for (i = 0, len = items.length; i < len; i++) {
775 item.preventLayout = true;
777 newWidth += item.getWidth();
778 delete item.preventLayout;
780 me.setWidth(newWidth);
783 // Resize the owning group to accommodate
784 if (ownerCt.isGroupHeader && me.preventLayout !== true) {
785 items = ownerCt.query('>:not([hidden])');
786 for (i = 0, len = items.length; i < len; i++) {
787 newWidth += items[i].getWidth();
789 ownerCt.minWidth = newWidth;
790 ownerCt.setWidth(newWidth);
793 // Notify owning HeaderContainer
794 ownerCt = me.getOwnerHeaderCt();
796 ownerCt.onHeaderShow(me, me.preventLayout);
800 getDesiredWidth: function() {
802 if (me.rendered && me.componentLayout && me.componentLayout.lastComponentSize) {
803 // headers always have either a width or a flex
804 // because HeaderContainer sets a defaults width
805 // therefore we can ignore the natural width
806 // we use the componentLayout's tracked width so that
807 // we can calculate the desired width when rendered
808 // but not visible because its being obscured by a layout
809 return me.componentLayout.lastComponentSize.width;
810 // Flexed but yet to be rendered this could be the case
811 // where a HeaderContainer and Headers are simply used as data
812 // structures and not rendered.
815 // this is going to be wrong, the defaultWidth
823 getCellSelector: function() {
824 return '.' + Ext.baseCSSPrefix + 'grid-cell-' + this.getItemId();
827 getCellInnerSelector: function() {
828 return this.getCellSelector() + ' .' + Ext.baseCSSPrefix + 'grid-cell-inner';
831 isOnLeftEdge: function(e) {
832 return (e.getXY()[0] - this.el.getLeft() <= this.handleWidth);
835 isOnRightEdge: function(e) {
836 return (this.el.getRight() - e.getXY()[0] <= this.handleWidth);
839 // intentionally omit getEditor and setEditor definitions bc we applyIf into columns
840 // when the editing plugin is injected
842 <span id='Ext-grid-column-Column-method-getEditor'> /**
843 </span> * @method getEditor
844 * Retrieves the editing field for editing associated with this header. Returns false if there is no field
845 * associated with the Header the method will return false. If the field has not been instantiated it will be
846 * created. Note: These methods only has an implementation if a Editing plugin has been enabled on the grid.
847 * @param {Object} record The {@link Ext.data.Model Model} instance being edited.
848 * @param {Object} defaultField An object representing a default field to be created
849 * @return {Ext.form.field.Field} field
851 <span id='Ext-grid-column-Column-method-setEditor'> /**
852 </span> * @method setEditor
853 * Sets the form field to be used for editing. Note: This method only has an implementation if an Editing plugin has
854 * been enabled on the grid.
855 * @param {Object} field An object representing a field to be created. If no xtype is specified a 'textfield' is