PDA

View Full Version : [OPEN] [#125] Disable sort when click GridPanel's Header



RCN
Jan 14, 2013, 5:08 PM
I would like to know whether it's possible to disable sort when click GridPanel's Header. I found the following 1.x examples, but i was not able to accomplish it on version 2.x

http://forums.ext.net/showthread.php?19647-CLOSED-Column-header-sorting-icon-in-gridpanel

http://forums.ext.net/showthread.php?12608-CLOSED-How-to-disable-sorting-by-click-the-header-of-column-in-GridPanel

returning false on ColumnModel' HeaderClick handler has no effect.

Any ideas to overcome this issue?

Baidaly
Jan 14, 2013, 11:45 PM
Hello!

Unfortunately, there is no default way to disable sorting on header click. However, you can use following overriding and custom config:



Ext.override(Ext.grid.column.Column, {
onElClick: function (e, t) {
var me = this,
ownerHeaderCt = me.getOwnerHeaderCt();
if (ownerHeaderCt && !ownerHeaderCt.ddLock) {
if (me.triggerEl && (e.target === me.triggerEl.dom || t === me.triggerEl.dom || e.within(me.triggerEl))) {
ownerHeaderCt.onHeaderTriggerClick(me, e, t);
} else if (e.getKey() || (!me.isOnLeftEdge(e) && !me.isOnRightEdge(e))) {
if (!this.disableSortOnHeaderClick)
me.toggleSortState();
ownerHeaderCt.onHeaderClick(me, e, t);
}
}
}

});




<ext:Column runat="server" Text="Company" DataIndex="company" Flex="1">
<CustomConfig>
<ext:ConfigItem Name="disableSortOnHeaderClick" Value="true" Mode="Raw" />
</CustomConfig>
</ext:Column>

Vladimir
Jan 14, 2013, 11:58 PM
You can use Sortable=false for a column but it disables column menu sort items also

Daniil
Jan 15, 2013, 9:04 AM
Hi everybody,

I tried to report this functionality regress as a bug.
http://www.sencha.com/forum/showthread.php?253875

Hope they will implement a special config option for this.

Daniil
Jan 15, 2013, 3:13 PM
Sencha opened a bug ticket.

We created an Issue to monitor.
https://github.com/extnet/Ext.NET/issues/125