Rest 在组合框上设置存储动态
嗨, 我有两个组合框。第二个组合框的值取决于第一个组合选择。用户确实选择了第一个组合,然后将相应地设置第二个组合的存储 以下是我的两个组合: 组合1Rest 在组合框上设置存储动态,rest,extjs,Rest,Extjs,嗨, 我有两个组合框。第二个组合框的值取决于第一个组合选择。用户确实选择了第一个组合,然后将相应地设置第二个组合的存储 以下是我的两个组合: 组合1 items:[ { xtype : 'combo', name : 'cmbSATopFacility', labelStyle : 'color: black; font-weight: bold; width: 250px; padding: 10;',
items:[
{
xtype : 'combo',
name : 'cmbSATopFacility',
labelStyle : 'color: black; font-weight: bold; width: 250px; padding: 10;',
labelSeparator : "",
id : 'cmbSATopFacility',
width : 250,
fieldLabel : 'Top MGMT Entity',
triggerAction : 'all',
store : Ext
.create(
'Ext.data.Store',
{
id : 'store',
fields : [
{
name : 'id',
type : 'integer',
},
{
name : 'name'
} ],
remoteGroup : true,
remoteSort : true,
proxy : {
type : 'rest',
url : 'pmsRest/facilities?sub_facility_id=-3',
reader : {
root : "facilityMaster",
idProperty : 'id'
}
},
autoLoad : true
}),
displayField : 'name',
valueField : 'id',
multiSelect : false,
typeAhead : true,
listeners : {
change : function(combo) {
/// code to convert GMT String to date object
n();
Ext.getCmp('cmbSAMedFacility').getStore().load();
}
},
allowBlank : false,
//enableKeyEvents : true,
},
组合2
{
xtype : 'combo',
name : 'cmbSAMedFacility',
labelStyle : 'color:black;font-weight:bold;width:250px;padding:10;',
labelSeparator : "",
id : 'cmbSAMedFacility',
width : 250,
fieldLabel : 'Institution',
triggerAction : 'all',
store : medfacility,
displayField : 'name',
valueField : 'id',
multiSelect : false,
typeAhead : true,
//disabled: true,
listeners : {
click : function(combo) {
alert("hjdfhcsdj");
n();
Ext.getCmp(this).getStore().load();
}
},
allowBlank : false,
//enableKeyEvents : true,
},
]
设置存储的代码
var medfacity=loadFacility()
我试图
获取第二个组合中的值,但没有成功。我想你需要描述第二个组合框的存储,但没有数据(空数组)。
WE CAN USE ONLY
listeners : { change : function(combo) { Ext.getCmp('cmbSAMedFacility').bindStore(n());}},
并在需要时使用填充该存储的数据
希望这能有所帮助。请提出一些解决方案请澄清您的问题,并请缩进您的代码。这将帮助其他用户理解并帮助您:)
WE CAN USE ONLY
listeners : { change : function(combo) { Ext.getCmp('cmbSAMedFacility').bindStore(n());}},