Выбор пользователя и группы
Столкнулся с такой проблемой. (Так как не сильно вник в работу ExtJs, может задача не очень сложная)
Пытаюсь сделать так:
Подскажите как решить данную проблему.
Пытаюсь сделать так:
tps: ['user', 'usergroup', 'all']
, getFields: function (config) {
var data = [];
data.push(['user', _('simplemodal_create_user')]);
data.push(['usergroup', _('simplemodal_create_usergroup')]);
data.push(['all', _('simplemodal_create_all')]);
var items = [{
xtype: 'combo'
, fieldLabel: _('simplemodal_recipient_type')
, name: 'type'
, hiddenName: 'type'
, store: new Ext.data.SimpleStore({
fields: ['type', 'disp']
, data: data
})
, mode: 'local'
, triggerAction: 'all'
, displayField: 'disp'
, valueField: 'type'
, editable: false
, value: data[0][0]
, listeners: {
'select': {fn: this.showRecipient, scope: this}
}
, anchor: '100%'
}];
items.push({
xtype: 'modx-combo-user'
, name: 'user'
, id: 'mc-recipient-user'
, fieldLabel: _('simplemodal_itessssm_user')
, allowBlank: false
, anchor: '100%'
});
items.push({
xtype: 'modx-combo-usergroup'
, name: 'group'
, id: 'mc-recipient-usergroup'
, fieldLabel: _('simplemodal_item_usergroup')
, allowBlank: false
, anchor: '100%'
});
items.push({
xtype: 'hidden'
, id: 'mc-recipient-all'
, name: 'all'
, fieldLabel: _('all')
, value: 'all'
});
Смена поля:, showRecipient: function (cb, rec, i) {
var form = this.fp.getForm();
for (var x = 0; x < this.tps.length; x++) {
var f = form.findField('mc-recipient-' + this.tps[x]);
if (f) {
this.hideField(f);
}
}
var type = rec ? rec.data.type : 'user';
var fd = form.findField('mc-recipient-' + type);
if (fd) {
this.showField(fd);
}
}
Но так как в полях пользователя и группы нету config.id то при повторном открытии окна выходит вот:Подскажите как решить данную проблему.
Поблагодарить автора
Отправить деньги