PDA

View Full Version : Remove 'Sort Ascending,' 'Sort Descending' Options from menu



pladhe
1 Apr 2014, 11:51 PM
I want to remove 'Sort Ascending,' 'Sort Descending' Options from menu on one of my column.
Where should i add following code,

grid.on('viewready', function(){
grid.getView().hmenu.getComponent('asc').hide();
grid.getView().hmenu.getComponent('desc').hide();
});

Currently i have disabled 'Sort Ascending,' 'Sort Descending' Options using "menuDisabled: true".
But i want to remove these options completely.
Please help.

mdnaveed42
2 Apr 2014, 4:23 AM
Css option: (This will be applied to all grids)

Check it in Fiddle (https://fiddle.sencha.com/fiddle/4n9)

.x-hmenu-sort-asc,
.x-hmenu-sort-desc {
display: none;
}


Also have a look at menuSortDescCls(private) (http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.grid.header.Container-property-menuSortDescCls) and getColumnMenu
(http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.grid.header.Container-method-getColumnMenu)
Thanks,
Md Naveed
\m/

pladhe
2 Apr 2014, 4:38 AM
Thanks for the reply Naveed. Actually i have following test code,
initComponent: function()
{ var me = this;
Ext.applyIf(me,
{ viewConfig: { id: 'TestView' },
forceFit: true,
columns: [ { xtype: 'gridcolumn', dataIndex: 'status',
text: TEST_HEADER,
flex: 1,
renderer: function (value, m, record)
{ m.tdCls = m.tdCls +" test-grid-row"; return value; } },
{ xtype: 'gridcolumn',
dataIndex: 'testoperations', text: ' ',
sortable : false, flex: 1.5,
renderer: function (value, m, record)
{ m.tdCls = m.tdCls +" test-grid-row"; return value;
} } ] });
me.callParent(arguments); },
I want to remove sorting options completely from last column. Where can i put your suggested code in above test code?