【发布时间】:2018-03-23 08:05:09
【问题描述】:
在 ViewModel 中,我定义了 2 个商店,并使用 gridpanel 作为视图。是否有机会说明gridpanel 内部bind 属性的 if else 条件?
视图模型:
stores: {
dataStore: {
model: 'MyApp.first.Model',
autoLoad: true,
session: true
},
listStore: {
model: 'MyApp.second.Model',
autoLoad: true,
session: true,
},
在网格面板上我想做这个条件;
Ext.define('MyApp.base.Grid', {
extend: 'Ext.grid.Panel',
// Currently binds directly to listStore
bind: '{listStore}',
// but I'm trying to implement a proper adjustment such as this;
// bind: function () {
// var username = localStorage.getItem('username');
// if (username === 'sample@adress.com') {'{dataStore}';} else {'{listStore}'}
// },
【问题讨论】:
标签: javascript if-statement extjs bind viewmodel