<!DOCTYPE html>
|
<html>
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>The source code</title>
|
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
|
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
|
<style type="text/css">
|
.highlight { display: block; background-color: #ddd; }
|
</style>
|
<script type="text/javascript">
|
function highlight() {
|
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
|
}
|
</script>
|
</head>
|
<body onload="prettyPrint(); highlight();">
|
<pre class="prettyprint lang-js"><span id='Ext-grid-ColumnManager'>/**
|
</span> * @private
|
*
|
* Manages and provides information about a TablePanel's *visible leaf* columns.
|
*/
|
Ext.define('Ext.grid.ColumnManager', {
|
alternateClassName: ['Ext.grid.ColumnModel'],
|
|
<span id='Ext-grid-ColumnManager-property-columns'> columns: null,
|
</span>
|
<span id='Ext-grid-ColumnManager-method-constructor'> constructor: function(headerCt, secondHeaderCt) {
|
</span> //<debug>
|
if (!headerCt.isRootHeader) {
|
Ext.Error.raise('ColumnManager must be passed an instantiated HeaderContainer');
|
}
|
//</debug>
|
this.headerCt = headerCt;
|
|
// We are managing columns for a lockable grid...
|
if (secondHeaderCt) {
|
//<debug>
|
if (!headerCt.isRootHeader) {
|
Ext.Error.raise('ColumnManager must be passed an instantiated HeaderContainer');
|
}
|
//</debug>
|
this.secondHeaderCt = secondHeaderCt;
|
}
|
},
|
|
<span id='Ext-grid-ColumnManager-method-getColumns'> getColumns: function() {
|
</span> if (!this.columns) {
|
this.cacheColumns();
|
}
|
return this.columns;
|
},
|
|
<span id='Ext-grid-ColumnManager-method-getHeaderIndex'> /**
|
</span> * Returns the index of a leaf level header regardless of what the nesting
|
* structure is.
|
*
|
* If a group header is passed, the index of the first leaf level heder within it is returned.
|
*
|
* @param {Ext.grid.column.Column} header The header to find the index of
|
* @return {Number} The index of the specified column header
|
*/
|
getHeaderIndex: function(header) {
|
// If we are being asked the index of a group header, find the first leaf header node, and return the index of that
|
if (header.isGroupHeader) {
|
header = header.down(':not([isGroupHeader])');
|
}
|
return Ext.Array.indexOf(this.getColumns(), header);
|
},
|
|
<span id='Ext-grid-ColumnManager-method-getHeaderAtIndex'> /**
|
</span> * Get a leaf level header by index regardless of what the nesting
|
* structure is.
|
* @param {Number} index The column index for which to retrieve the column.
|
* @return {Ext.grid.column.Column} The header. `null` if it doesn't exist.
|
*/
|
getHeaderAtIndex: function(index) {
|
var columns = this.getColumns();
|
return columns.length ? columns[index] : null;
|
},
|
|
<span id='Ext-grid-ColumnManager-method-getHeaderById'> /**
|
</span> * Get a leaf level header by index regardless of what the nesting
|
* structure is.
|
* @param {String} id The id
|
* @return {Ext.grid.column.Column} The header. `null` if it doesn't exist.
|
*/
|
getHeaderById: function(id) {
|
var columns = this.getColumns(),
|
len = columns.length,
|
i, header;
|
|
for (i = 0; i < len; ++i) {
|
header = columns[i];
|
if (header.getItemId() === id) {
|
return header;
|
}
|
}
|
return null;
|
},
|
|
<span id='Ext-grid-ColumnManager-method-getVisibleHeaderClosestToIndex'> /**
|
</span> * When passed a column index, returns the closet *visible* column to that. If the column at the passed index is visible,
|
* that is returned. If it is hidden, either the next visible, or the previous visible column is returned.
|
* @param {Number} index Position at which to find the closest visible column.
|
*/
|
getVisibleHeaderClosestToIndex: function(index) {
|
var result = this.getHeaderAtIndex(index);
|
if (result && result.hidden) {
|
result = result.next(':not([hidden])') || result.prev(':not([hidden])');
|
}
|
return result;
|
},
|
|
<span id='Ext-grid-ColumnManager-method-cacheColumns'> cacheColumns: function() {
|
</span> this.columns = this.headerCt.getVisibleGridColumns();
|
if (this.secondHeaderCt) {
|
Ext.Array.push(this.columns, this.secondHeaderCt.getVisibleGridColumns());
|
}
|
},
|
|
<span id='Ext-grid-ColumnManager-method-invalidate'> invalidate: function() {
|
</span> this.columns = null;
|
|
// If we are part of a lockable assembly, invalidate the root column manager
|
if (this.rootColumns) {
|
this.rootColumns.invalidate();
|
}
|
}
|
}, function() {
|
this.createAlias('indexOf', 'getHeaderIndex');
|
});</pre>
|
</body>
|
</html>
|