+ for (; i < headersLn; i++) {
+ header = headers[i];
+
+ if (header.hidden) {
+ width = 0;
+ } else {
+ width = header.getDesiredWidth();
+ // IE6 and IE7 bug.
+ // Setting the width of the first TD does not work - ends up with a 1 pixel discrepancy.
+ // We need to increment the passed with in this case.
+ if ((i == 0) && (Ext.isIE6 || Ext.isIE7)) {
+ width += 1;
+ }
+ }
+ cols.push({
+ dataIndex: header.dataIndex,
+ align: header.align,
+ width: width,
+ id: header.id,
+ cls: header.tdCls,
+ columnId: header.getItemId()
+ });
+ }
+ return cols;
+ },
+
+<span id='Ext-grid-header-Container-method-getColumnCount'> /**
+</span> * Returns the number of <b>grid columns</b> descended from this HeaderContainer.
+ * Group Columns are HeaderContainers. All grid columns are returned, including hidden ones.
+ */
+ getColumnCount: function() {
+ return this.getGridColumns().length;
+ },
+
+<span id='Ext-grid-header-Container-method-getFullWidth'> /**
+</span> * Gets the full width of all columns that are visible.
+ */
+ getFullWidth: function(flushCache) {
+ var fullWidth = 0,
+ headers = this.getVisibleGridColumns(flushCache),
+ headersLn = headers.length,
+ i = 0;
+
+ for (; i < headersLn; i++) {
+ if (!isNaN(headers[i].width)) {
+ // use headers getDesiredWidth if its there
+ if (headers[i].getDesiredWidth) {
+ fullWidth += headers[i].getDesiredWidth();
+ // if injected a diff cmp use getWidth
+ } else {
+ fullWidth += headers[i].getWidth();
+ }
+ }
+ }
+ return fullWidth;
+ },
+
+ // invoked internally by a header when not using triStateSorting
+ clearOtherSortStates: function(activeHeader) {
+ var headers = this.getGridColumns(),
+ headersLn = headers.length,
+ i = 0,
+ oldSortState;
+
+ for (; i < headersLn; i++) {
+ if (headers[i] !== activeHeader) {
+ oldSortState = headers[i].sortState;
+ // unset the sortstate and dont recurse
+ headers[i].setSortState(null, true);
+ //if (!silent && oldSortState !== null) {
+ // this.fireEvent('sortchange', this, headers[i], null);
+ //}
+ }
+ }
+ },
+
+<span id='Ext-grid-header-Container-method-getVisibleGridColumns'> /**
+</span> * Returns an array of the <b>visible</b> columns in the grid. This goes down to the lowest column header
+ * level, and does not return <i>grouped</i> headers which contain sub headers.
+ * @param {Boolean} refreshCache If omitted, the cached set of columns will be returned. Pass true to refresh the cache.
+ * @returns {Array}
+ */
+ getVisibleGridColumns: function(refreshCache) {
+ return Ext.ComponentQuery.query(':not([hidden])', this.getGridColumns(refreshCache));
+ },
+
+<span id='Ext-grid-header-Container-method-getGridColumns'> /**
+</span> * Returns an array of all columns which map to Store fields. This goes down to the lowest column header
+ * level, and does not return <i>grouped</i> headers which contain sub headers.
+ * @param {Boolean} refreshCache If omitted, the cached set of columns will be returned. Pass true to refresh the cache.
+ * @returns {Array}
+ */
+ getGridColumns: function(refreshCache) {
+ var me = this,
+ result = refreshCache ? null : me.gridDataColumns;
+
+ // Not already got the column cache, so collect the base columns
+ if (!result) {
+ me.gridDataColumns = result = [];
+ me.cascade(function(c) {
+ if ((c !== me) && !c.isGroupHeader) {
+ result.push(c);
+ }
+ });
+ }
+
+ return result;
+ },
+
+<span id='Ext-grid-header-Container-method-getHeaderIndex'> /**
+</span> * Get the index of a leaf level header regardless of what the nesting
+ * structure is.
+ */
+ getHeaderIndex: function(header) {
+ var columns = this.getGridColumns();
+ return Ext.Array.indexOf(columns, header);
+ },
+
+<span id='Ext-grid-header-Container-method-getHeaderAtIndex'> /**
+</span> * Get a leaf level header by index regardless of what the nesting
+ * structure is.
+ */
+ getHeaderAtIndex: function(index) {
+ var columns = this.getGridColumns();
+ return columns[index];
+ },
+
+<span id='Ext-grid-header-Container-method-prepareData'> /**
+</span> * Maps the record data to base it on the header id's.
+ * This correlates to the markup/template generated by
+ * TableChunker.
+ */
+ prepareData: function(data, rowIdx, record, view, panel) {
+ var obj = {},
+ headers = this.gridDataColumns || this.getGridColumns(),
+ headersLn = headers.length,
+ colIdx = 0,
+ header,
+ headerId,
+ renderer,
+ value,
+ metaData,
+ store = panel.store;
+
+ for (; colIdx < headersLn; colIdx++) {
+ metaData = {
+ tdCls: '',
+ style: ''
+ };
+ header = headers[colIdx];
+ headerId = header.id;
+ renderer = header.renderer;
+ value = data[header.dataIndex];
+
+ // When specifying a renderer as a string, it always resolves
+ // to Ext.util.Format
+ if (typeof renderer === "string") {
+ header.renderer = renderer = Ext.util.Format[renderer];
+ }
+
+ if (typeof renderer === "function") {
+ value = renderer.call(
+ header.scope || this.ownerCt,
+ value,
+ // metadata per cell passing an obj by reference so that
+ // it can be manipulated inside the renderer
+ metaData,
+ record,
+ rowIdx,
+ colIdx,
+ store,
+ view
+ );
+ }
+
+ // <debug>
+ if (metaData.css) {
+ // This warning attribute is used by the compat layer
+ obj.cssWarning = true;
+ metaData.tdCls = metaData.css;
+ delete metaData.css;
+ }
+ // </debug>
+
+ obj[headerId+'-modified'] = record.isModified(header.dataIndex) ? Ext.baseCSSPrefix + 'grid-dirty-cell' : '';
+ obj[headerId+'-tdCls'] = metaData.tdCls;
+ obj[headerId+'-tdAttr'] = metaData.tdAttr;
+ obj[headerId+'-style'] = metaData.style;
+ if (value === undefined || value === null || value === '') {
+ value = '&#160;';