1 Attachment(s)
how to enable grid geader sorting context menu and catch the click event on it ?
hi,
I have a grid panel and there is a header context menu, but the sorting menu gets disabled.
ow can I enable the sorting ASC/DES menu and handle the clicking event on it ?
besides, the sorting is on grid's datastore ?
here is the code for the grid.
///////////////////////////////////////////////////////////////////
function snpGrid_universal (divId, JsonData)
{
var len = JsonData.col_headers.length;
var dataStore = new Ext.data.Store ({
reader: new Ext.data.JsonReader ({
root: 'snpRows',
totalProperty: 'totalSnp',
id: 'snpId'
},
JsonData.snpRows_index
)
});
dataStore.loadData (JsonData);
var colModelArray = [];
for (var i=0; i < len; i++){
colModelArray.push(
{header: JsonData.col_headers[i], dataIndex: JsonData.snpRows_index[i], tooltip: JsonData.col_header_desc[i], width: JsonData.col_widths[i], align:JsonData.col_aligns[i], sortable: true }
);
}
var columnModel = new Ext.grid.ColumnModel (colModelArray );
var snpTable = new Ext.grid.GridPanel ({
ds: dataStore,
cm: columnModel,
id: divId,
applyTo: divId,
height: 140,
width: 720,
enableHdMenu: true,
loadMask: true
});
snpTable.render;
// hide sort menus
snpTable.view.hmenu.on('beforeshow',function() {
//snpTable.view.hmenu.items.get(0).hide();
//snpTable.view.hmenu.items.get(1).hide();
snpTable.view.hmenu.items.get(2).hide();
//var colsubMenu = snpTable.view.hmenu.items.get(3);
//if(colsubMenu)
// colsubMenu.???;
});
}
//////////////////////////////////////////////////////////////////////