我有这样的看法:
Ext.define('Webedi.view.zones.Menu', {
store: 'PartnerSettings',
extend: 'Ext.panel.Panel',
.
.
.
.
adminPanelEnabled: false,
initComponent: function() {
var me = this;
console.log(Ext.getStore('Userrights').findExact("name","admin_panel_access"));
if(Ext.getStore('Userrights').findExact("name","admin_panel_access") !== -1) me.adminPanelEnabled = true;
// if(Ext.getStore('PartnerSettings').getAt(0).get('purchasingOrganisation').enabled ) me.purchasingOrganisationEnabled = true;
this.items = [
.
.
.
.
{
id: 'adminpanel',
itemId: 'adminpanel',
xtype: 'button',
text: Translation.ZonesMenuAdminPanel,
action: 'adminpanel',
margin: '3 3 0 3',
hidden: !me.adminPanelEnabled
}
]
}
];
this.callParent();
}
});
问题是
if(Ext.getStore('Userrights').findExact("name","admin_panel_access") !== -1)
部分代码运行时间尚未填写:
hidden: !me.adminPanelEnabled
initComponent
功能启动?