Knowing this is an old thread, but I would like to share it as I had the same issue.
I solved it through overriding the click event handlers of Ext.grid.column.Column. There is a private onElDblClick event handled for double clicking on the edge of the column header.
Override this function to also handle double click on the entire column header.
Next is to override the onElClick event handler to let it know there could be a double click action pending via a SetTimeout call, otherwise any events attached to the single click event like sorting and the pull down menu will be called always.
See the below code to override it. I only tested it on ExtJS 4.1.1a, but would be easily ported to other ExtJS versions.
// enable doubleclick on the column to expand it to the max width as well
Ext.override(Ext.grid.column.Column, {
/**
* @private
* Double click
* @param e
* @param t
*/
onElDblClick: function(e, t) {
var me = this,
ownerCt = me.ownerCt;
if (ownerCt && Ext.Array.indexOf(ownerCt.items, me) !== 0) {
if (me.isOnLeftEdge(e) ) {
ownerCt.expandToFit(me.previousSibling('gridcolumn'));
} else {
ownerCt.expandToFit(me);
}
}
},
onElClick: function(e, t) {
// The grid's docked HeaderContainer.
var me = this,
ownerHeaderCt = me.getOwnerHeaderCt();
if (me.el.getAttribute("data-dblclick") == null) {
me.el.dom.setAttribute("data-dblclick", 1);
setTimeout(function () {
if (me.el.getAttribute("data-dblclick") == 1) {
handleElClick(me, e, t);
}
me.el.dom.removeAttribute("data-dblclick");
}, 300);
} else {
me.el.dom.removeAttribute("data-dblclick");
me.onElDblClick(e, t);
}
function handleElClick(me, e, t) {
var ownerHeaderCt = me.getOwnerHeaderCt();
if (ownerHeaderCt && !ownerHeaderCt.ddLock) {
// Firefox doesn't check the current target in a within check.
// Therefore we check the target directly and then within (ancestors)
if (me.triggerEl && (e.target === me.triggerEl.dom || t === me.triggerEl.dom || e.within(me.triggerEl))) {
ownerHeaderCt.onHeaderTriggerClick(me, e, t);
// if its not on the left hand edge, sort
} else if (e.getKey() || (!me.isOnLeftEdge(e) && !me.isOnRightEdge(e))) {
me.toggleSortState();
ownerHeaderCt.onHeaderClick(me, e, t);
}
}
}
}
});
The double click check is an adapted version I found here https://stackoverflow.com/a/16033129/3436982.