它实际上是一个外部窗口,第一次单击打开窗口,组合框包含值,但第二次和第三次不再是。我可以知道如何重装我的组合框吗?
尝试重新加载组合框的几种方法,但失败了,请给我一些想法。 以下是我的代码。
ViewUserRole = Ext.extend(One.Report, { reportName : '.ViewUserRoles', customModelName : 'Standard Role', autoExecute: true, isDetailPage: false, listeners: { bbarconfig: function(report, bbarConfig) { bbarConfig.items.push({ xtype: 'button', text: 'Create New Role', disabled: false, listeners: { click : function(btn, e) { var w = new .CreateNewUserRole(); w.show(); } } }); } } }); One.PageMgr.regDetail('Role', '.ViewUserRole');
// To call new Create User Role Form
CreateNewUserRole = new Ext.extend(Ext.Window,{
id:'CreateNewUserRole',
height :250,
minHeight: 220,
width:550,
minWidth: 500,
modal:true,
title: Form_NewRole,
layout: 'form',
plain: true,
initComponent: function() {
this.items = [new .CreateUserRoleForm()];
.CreateNewUserRole.superclass.initComponent.apply(this, arguments);
},
bodyStyle: 'padding:5px;',
buttonAlign: 'center',
buttons: [{
text: Button_ReadMe,
listeners: {
click : function(btn, e) {
Ext.MessageBox.show({
title: Header_Information,
msg: Msg_CreateUserRoleNameExplain,
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.INFO
});
}
}
},{
text: Button_Save,
handler:function(){
Ext.Ajax.request({
url: '/oms/rest/manageuserrole/addnewrole',
params: {
enterpriseId: enterpriseId, organizationId: organizationId
},
method: 'GET',
success: function() {
Ext.Msg.alert(Msg_SuccessfullyCreatedUserRole);
Ext.getCmp('CreateNewUserRole').close();
},
failure: function(response, opts) {
Ext.MessageBox.show({
title: Header_Error,
msg: 'Server-side failure with status code ' + response.status,
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
},
scope: this
});
}
},{
text: Button_Cancel,
handler:function(){
Ext.getCmp('CreateNewUserRole').close();
}
}]
});
// Get All Enterprise List from Database
var enterpriseListStore = new Ext.data.JsonStore({
autoLoad: true,
url: '/oms/rest/getEntOrgList/getEnterpriseList',
root : 'enterprise',
fields :[{name: "enterpriseID", type: "int"},{name: "enterpriseName", type: "string"}]
});
//Get All Organization List from Database
var organizationListStore = new Ext.data.JsonStore({
autoLoad: true,
url: '/oms/rest/getEntOrgList/getOrganizationList',
root : 'organization',
fields :[{name: "organizationID", type: "int"},{name: "organizationName", type: "string"}]
});
// Create User Role Design
CreateUserRoleForm = Ext.extend(Ext.form.FormPanel, {
initComponent : function() {
this.items = [{
xtype : 'combo',
id : 'EnterpriseSel',
fieldLabel : Field_Enterprise,
name : 'enterprise',
displayField : 'enterpriseName',
valueField : 'enterpriseID',
baseCls : 'fwd_floatLeft',
anchor : '75%',
queryMode : 'local',
mode : 'local',
editable : false,
triggerAction : 'all',
listClass : 'comboalign',
typeAhead : true,
labelWidth : 50,
hiddenName : 'number',
selectOnFocus : true,
store : new Ext.data.JsonStore({
storeId : 'enterpriseListStoreId',
autoLoad : false,
url : '/oms/rest/getEntOrgSiteList/getEnterpriseList',
root : 'enterprise',
fields :[{name: "enterpriseID", type: "int"},{name: "enterpriseName", type: "string"}]
}),
listeners : {
change: function(field, newValue, oldValue){
organizationListStore.load();
}
}
},{
xtype : 'combo',
id : 'OrganizationSel',
fieldLabel : Field_Organization,
name : 'organization',
displayField : 'organizationName',
valueField : 'organizationID',
baseCls : 'fwd_floatLeft',
anchor : '75%',
queryMode : 'local',
mode : 'local',
editable : false,
triggerAction : 'all',
listClass : 'comboalign',
typeAhead : true,
labelWidth : 50,
hiddenName : 'number',
selectOnFocus : true,
store : organizationListStore
}];
CreateUserRoleForm.superclass.initComponent.apply(this, arguments);
}
});
答案 0 :(得分:1)
首先,
CreateNewUserRole = new Ext.extend(Ext.Window,{
应改为
CreateNewUserRole = Ext.extend(Ext.Window,{
Combobox的定义在哪里,看看它是否有任何问题?您可以在CreateUserRoleForm中为组合框指定静态“id”。
您可以使用storeId -
定义商店var enterpriseListStore = new Ext.data.JsonStore({
autoLoad: true,
storeId : "enterprise-lists",
url: '/oms/rest/getEntOrgList/getEnterpriseList',
root : 'enterprise',
fields :[{name: "enterpriseID", type: "int"},{name: "enterpriseName", type: "string"}]
});
var organizationListStore = new Ext.data.JsonStore({
autoLoad: true,
storeId : "organization-lists",
url: '/oms/rest/getEntOrgList/getOrganizationList',
root : 'organization',
fields :[{name: "organizationID", type: "int"},{name: "organizationName", type: "string"}]
});
这样即使窗户关闭也不会被破坏。