2 콤보 상자 세트가 있습니다. 하나는 국가의 콤보이며 다른 하나는 국가의 콤보입니다. 기본적으로 국가를 선택하면 국가 콤보 저장소가 비어 있고 콤보 값 필드를 기반으로합니다. 국가 콤보는 첫 번째 콤보에 따라 필터링되거나로드되어야합니다. Extjs2.0에서는 Extjs4의 변경 내용이 작동합니다.Extjs4 연결 콤보
국가 저장소
var country_store = Ext.create('Ext.data.Store', {
//autoLoad: true,
fields: ['id','c_id','c_name'],
proxy: {
type: 'ajax',
url: 'country_list.php',
reader: {
type:'json',
root: 'results'
}
},
storeId: 'edu_context_store'
});
주 저장소
var state_name = Ext.create('Ext.data.Store', {
autoLoad: true,
fields: ['id','s_id','s_name','parent_country_id'],
proxy: {
type: 'ajax',
url: 'states_list.php',
reader: {
type:'json',
root: 'results'
}
},
storeId: 'state_name'
});
콤보 상자
는{
xtype: 'combo',
id: 'country_combo',
hiddenName: 'country_name',
displayField: 'c_name',
valueField: 'c_id',
fieldLabel: 'Country',
queryMode: 'remote',
allowBlank: false,
triggerAction: 'all',
store: country_store,
width: 450,
selectOnFocus: true,
listeners:{
scope: this,
'select': function(combo, rec, idx){
var country_val = combo.getRawValue();
var states_obj = Ext.getCmp('states_combo');
states_obj.clearValue();
//states_obj.store.load();
states_obj.store.filter('parent_country_id', country_val);
}
}
}, {
xtype: 'combo',
id: 'states_combo',
hiddenName:'state_name',
displayField:'s_name',
valueField:'s_id',
queryMode: 'remote',
fieldLabel: 'State',
cls: 'textlineht',
allowBlank: false,
triggerAction: 'all',
store: states_store,
width: 450
}
사람은 그렇게하는 방법을 알고?
감사합니다.
왜 댓글을 달았습니까? //states_obj.store.load(); – user1163459
상태 저장소에 autoLoad : true 속성을 정의했습니다. – siva565
^렌더링 될 때 한 번로드되므로 더 이상 – Mchl