Alien-Web-ExtJS-V3
view release on metacpan or search on metacpan
share/docs/source/GridView.html view on Meta::CPAN
* the column hide/show functionality based on the check state of the menu item. A different implementation can be provided
* if needed.
* @param {Ext.menu.BaseItem} item The menu item that was clicked
*/
handleHdMenuClickDefault: function(item) {
var colModel = this.cm,
itemId = item.getItemId(),
index = colModel.getIndexById(itemId.substr(4));
if (index != -1) {
if (item.checked && colModel.getColumnsBy(this.isHideableColumn, this).length <= 1) {
this.onDenyColumnHide();
return;
}
colModel.setHidden(index, item.checked);
}
},
<span id='Ext-grid-GridView-method-handleHdDown'> /**
</span> * @private
* Called when a header cell is clicked - shows the menu if the click happened over a trigger button
*/
handleHdDown : function(e, target) {
if (Ext.fly(target).hasClass('x-grid3-hd-btn')) {
e.stopEvent();
var colModel = this.cm,
header = this.findHeaderCell(target),
index = this.getCellIndex(header),
sortable = colModel.isSortable(index),
menu = this.hmenu,
menuItems = menu.items,
menuCls = this.headerMenuOpenCls,
sep;
this.hdCtxIndex = index;
Ext.fly(header).addClass(menuCls);
if (this.hideSortIcons) {
menuItems.get('asc').setVisible(sortable);
menuItems.get('desc').setVisible(sortable);
sep = menuItems.get('sortSep');
if (sep) {
sep.setVisible(sortable);
}
} else {
menuItems.get('asc').setDisabled(!sortable);
menuItems.get('desc').setDisabled(!sortable);
}
menu.on('hide', function() {
Ext.fly(header).removeClass(menuCls);
}, this, {single:true});
menu.show(target, 'tl-bl?');
}
},
<span id='Ext-grid-GridView-method-handleHdMove'> /**
</span> * @private
* Attached to the headers' mousemove event. This figures out the CSS cursor to use based on where the mouse is currently
* pointed. If the mouse is currently hovered over the extreme left or extreme right of any header cell and the cell next
* to it is resizable it is given the resize cursor, otherwise the cursor is set to an empty string.
*/
handleHdMove : function(e) {
var header = this.findHeaderCell(this.activeHdRef);
if (header && !this.headersDisabled) {
var handleWidth = this.splitHandleWidth || 5,
activeRegion = this.activeHdRegion,
headerStyle = header.style,
colModel = this.cm,
cursor = '',
pageX = e.getPageX();
if (this.grid.enableColumnResize !== false) {
var activeHeaderIndex = this.activeHdIndex,
previousVisible = this.getPreviousVisible(activeHeaderIndex),
currentResizable = colModel.isResizable(activeHeaderIndex),
previousResizable = previousVisible && colModel.isResizable(previousVisible),
inLeftResizer = pageX - activeRegion.left <= handleWidth,
inRightResizer = activeRegion.right - pageX <= (!this.activeHdBtn ? handleWidth : 2);
if (inLeftResizer && previousResizable) {
cursor = Ext.isAir ? 'move' : Ext.isWebKit ? 'e-resize' : 'col-resize'; // col-resize not always supported
} else if (inRightResizer && currentResizable) {
cursor = Ext.isAir ? 'move' : Ext.isWebKit ? 'w-resize' : 'col-resize';
}
}
headerStyle.cursor = cursor;
}
},
<span id='Ext-grid-GridView-method-getPreviousVisible'> /**
</span> * @private
* Returns the index of the nearest currently visible header to the left of the given index.
* @param {Number} index The header index
* @return {Number/undefined} The index of the nearest visible header
*/
getPreviousVisible: function(index) {
while (index > 0) {
if (!this.cm.isHidden(index - 1)) {
return index;
}
index--;
}
return undefined;
},
<span id='Ext-grid-GridView-method-handleHdOver'> /**
</span> * @private
* Tied to the header element's mouseover event - adds the over class to the header cell if the menu is not disabled
* for that cell
*/
handleHdOver : function(e, target) {
var header = this.findHeaderCell(target);
if (header && !this.headersDisabled) {
var fly = this.fly(header);
this.activeHdRef = target;
this.activeHdIndex = this.getCellIndex(header);
this.activeHdRegion = fly.getRegion();
if (!this.isMenuDisabled(this.activeHdIndex, fly)) {
fly.addClass('x-grid3-hd-over');
this.activeHdBtn = fly.child('.x-grid3-hd-btn');
if (this.activeHdBtn) {
this.activeHdBtn.dom.style.height = (header.firstChild.offsetHeight - 1) + 'px';
}
}
}
},
<span id='Ext-grid-GridView-method-handleHdOut'> /**
</span> * @private
* Tied to the header element's mouseout event. Removes the hover class from the header cell
*/
handleHdOut : function(e, target) {
var header = this.findHeaderCell(target);
if (header && (!Ext.isIE9m || !e.within(header, true))) {
this.activeHdRef = null;
this.fly(header).removeClass('x-grid3-hd-over');
header.style.cursor = '';
}
},
<span id='Ext-grid-GridView-method-isMenuDisabled'> /**
</span> * @private
* Used by {@link #handleHdOver} to determine whether or not to show the header menu class on cell hover
* @param {Number} cellIndex The header cell index
* @param {Ext.Element} el The cell element currently being hovered over
*/
isMenuDisabled: function(cellIndex, el) {
return this.cm.isMenuDisabled(cellIndex);
},
<span id='Ext-grid-GridView-method-hasRows'> /**
</span> * @private
* Returns true if there are any rows rendered into the GridView
* @return {Boolean} True if any rows have been rendered
*/
hasRows : function() {
var fc = this.mainBody.dom.firstChild;
return fc && fc.nodeType == 1 && fc.className != 'x-grid-empty';
},
<span id='Ext-grid-GridView-method-isHideableColumn'> /**
</span> * @private
*/
isHideableColumn : function(c) {
return !c.hidden;
},
<span id='Ext-grid-GridView-method-bind'> /**
</span> * @private
* DEPRECATED - will be removed in Ext JS 5.0
*/
bind : function(d, c) {
this.initData(d, c);
}
});
// private
// This is a support class used internally by the Grid components
Ext.grid.GridView.SplitDragZone = Ext.extend(Ext.dd.DDProxy, {
constructor: function(grid, hd){
this.grid = grid;
this.view = grid.getView();
this.marker = this.view.resizeMarker;
this.proxy = this.view.resizeProxy;
Ext.grid.GridView.SplitDragZone.superclass.constructor.call(this, hd,
'gridSplitters' + this.grid.getGridEl().id, {
dragElId : Ext.id(this.proxy.dom), resizeFrame:false
});
this.scroll = false;
this.hw = this.view.splitHandleWidth || 5;
},
b4StartDrag : function(x, y){
this.dragHeadersDisabled = this.view.headersDisabled;
this.view.headersDisabled = true;
( run in 0.327 second using v1.01-cache-2.11-cpan-f6376fbd888 )