我正在构建一个ExtJS 6应用程序,它有很多通用类构建的网格。这个通用类默认将Grid Header菜单设置为启用,但有时我需要将其禁用,并且我不知道如何执行此操作。
这是构建主网格配置的类,所有其他网格应该基于该网格配置(我不允许修改):
Ext.define('App.view.override.TMainBrowseGrid', {
override: 'App.view.TMainBrowseGrid',
initComponent: function () {
/* [A LOT OF IRRELEVANT CODE HERE] */
var oBuildCol = {};
/* [MORE OF IRRELEVANT CODE HERE] */
oBuildCol = {
xtype: cTipoCol,
itemId: (oCol.cSQLField === '' ? (oCol.cFieldName === '' ? null : oCol.cFieldName) : oCol.cSQLField),
dataIndex: (oCol.cSQLField === '' ? oCol.cFieldName : oCol.cSQLField),
text: oIdioma.Get(oCol.Header),
hidden: (oCol.lVisible == true ? false : true),
hideable: true,
sortable: false,
draggable: true,
align: oViewModel.getFormulas().getHeaderAlign(oCol.nAlignment),
tdCls: 'oGridCell-' + oViewModel.getFormulas().getCellAlign(oCol.nAlignment),
width: oCol.nWidth,
flex: (oCol.nWidth == 999 ? 1 : 0),
minWidth: (oCol.nWidth == 999 ? 140 : 40),
cCode: oCol.SrcOnGetData,
summaryType: oTipoSummary,
summaryRenderer: (oTipoSummary !== null ? Function('val', 'params', 'data', 'return "<b>"+val+"</b>";') : null),
renderer: (oCol.SrcOnGetData === '' ? false : function (value, metaData, record, rowIndex, colIndex, store, view) {
if (typeof metaData.column == 'undefined') {
if (typeof value == 'undefined') {
return '';
}
else {
return value;
}
}
var cCode = metaData.column.cCode;
if (cCode.length !== 0) {
eval(cCode);
}
return value;
})
};
/* [EVEN MORE IRRELEVANT CODE HERE !!! ] */
this.callParent();
}
});
这是我的观看代码:
Ext.define('App.view.TFormFrm', {
extend: 'Ext.tab.Panel',
alias: 'widget.TFormFrm',
requires: [
'App.view.TFormFrmViewModel',
'App.view.TFormFrmViewController',
'Ext.tab.Tab',
'Ext.grid.Panel',
'Ext.grid.column.RowNumberer',
'Ext.view.Table',
'Ext.toolbar.Paging',
'App.view.XBrowseColumn',
'App.model.oGridForm',
'App.model.oGridActs',
'Ext.grid.plugin.DragDrop',
'Ext.selection.RowModel'
],
config: {
nNivel: 0,
cAwp: 'TGlobalData',
cCodClass: 'FormBrw'
},
controller: 'TFormFrm',
viewModel: {
type: 'TFormFrm'
},
cls: 'CustomTabs',
activeTab: 0,
itemId: 'TFormFrm',
bind: {
title: '{lbl_Form}'
},
titleAlign: 'center',
deferredRender: false,
listeners: {
afterrender: 'onTFormFrmAfterRender'
},
items: [
{
xtype: 'panel',
itemId: 'oMainPanel',
layout: {
type: 'vbox',
align: 'stretch'
},
bind: {
title: '{lbl_Form}'
},
tabConfig: {
hidden: true
},
dockedItems: [
{
xtype: 'XActionToolbarFrm',
flex: 1,
dock: 'top',
itemId: 'oGridToolbar',
/* [IRRELEVANT CODE HERE] */
}
],
items: [
{
xtype: 'panel',
flex: 1,
itemId: 'oPnlCard',
layout: {
type: 'card',
deferredRender: false
},
items: [
{
xtype: 'panel',
itemId: 'oPnlContenedor',
layout: {
type: 'hbox',
align: 'stretch'
},
items: [
{
xtype: 'TMainBrowseGrid',
cBrwName: 'oBrwForm',
cCodForm: 'FormFrm',
alignOnScroll: false,
scrollable: true,
menuDisabled: true,
cls: 'CustomGrid',
itemId: 'oGridForm',
bind: {
store: '{oStoreForm}'
},
columns: [
{
xtype: 'rownumberer',
hidden: true
}
],
dockedItems: [
{
xtype: 'TPagingTB',
dock: 'bottom',
bind: {
store: '{oStoreForm}'
}
}
],
listeners: {
select: 'onFormSelect'
}
},
{
xtype: 'TMainBrowseGrid',
cBrwName: 'oBrwActs',
cCodForm: 'ActsFrm',
alignOnScroll: false,
scrollable: true,
cls: 'CustomGrid',
itemId: 'oGridActs',
bind: {
store: '{oStoreActs}'
},
columns: [
{
xtype: 'rownumberer',
hidden: true
}
],
dockedItems: [
{
xtype: 'TPagingTB',
dock: 'bottom',
bind: {
store: '{oStoreActs}'
}
}
],
listeners: {
afterrender: 'onOGridActsAfterRender'
}
}
]
}
]
}
]
}
]
});
我已尝试在视图中的所有位置设置menuDisabled: true
设置,但它似乎无法正常工作。我该怎么处理这个?
非常感谢。