Ext.define("AddProblem",{
extend:"CommonModule",
problemStore:null,
init:function(){
var me = this;
return me._createPanle();
},
_createPanle:function(){
var me=this;
var store1 = Ext.create("Ext.data.Store", {
fields : ['code', 'name','parentcode'],
autoLoad : true,
proxy : {
reader : {
root : 'records'
},
type : 'direct',
directFn:'DirectService.listType'
}
});
store1.on('beforeload',function(store,options){
store.proxy.extraParams.后台变量 =0;
store.proxy.extraParams.后台变量=1;
});
var store2 = Ext.create("Ext.data.Store", {
fields : ['code', 'name','parentcode'],
proxy : {
reader : {
root : 'records'
},
type : 'direct',
directFn:'DirectService.listType'
}
});
var store3 = Ext.create("Ext.data.Store", {
fields : ['code', 'name','parentcode'],
proxy : {
reader : {
root : 'records'
},
type : 'direct',
directFn:'DirectService.listType'
}
});
var addForm = Ext.create('Ext.form.Panel',{
frame: true,
header:false,
margin:3,
bodyPadding: '5 5 0',
collapsible: true,
width:520,
fieldDefaults: {
msgTarget: 'side',
labelWidth: 60,
margin:'0 15 0 0'
},
defaults:{
margin:'10 10 0 10'
},
api:{
submit:DirectService.insert
},
defaultType: 'textfield',
items: [{
xtype: 'fieldcontainer',
layout: 'hbox',
defaultType: 'textfield',
items: [{
name:'category',
hiddenName:'category',
width: 230,
xtype : 'combobox',
displayField : 'name',
valueField : 'code',
queryMode : 'local',
editable:false,
fieldLabel:'问题类别',
allowBlank: false,
blankText:'问题类别不能为空!',
store : store1,
listeners:{
select:function(itemSelect){
addForm.getForm().findField('type1').setValue('');
addForm.getForm().findField("type1").clearValue();
addForm.getForm().findField("type2").clearValue();
store2.load({params:{parentId:addForm.getForm().findField('category').getValue(),level:2}});
}
}]
},{
xtype: 'fieldcontainer',
layout: 'hbox',
defaultType: 'textfield',
items: [{
name:'type1',
hiddenName:'type1',
width: 230,
xtype : 'combobox',
displayField : 'name',
valueField : 'code',
queryMode : 'local',
editable:false,
fieldLabel:'大类',
allowBlank: false,
blankText:'大类不能为空!',
store :store2,
listeners:{
select:function(itemSelect){
addForm.getForm().findField('type2').setValue('');
addForm.getForm().findField("type2").clearValue();
store3.load({params:{parentId:addForm.getForm().findField('type1').getValue(),level:3}});
}
}
},{
name:'type2',
hiddenName:'type2',
width: 230,
xtype : 'combobox',
displayField : 'name',
valueField : 'code',
queryMode : 'local',
editable:false,
fieldLabel:'小类',
allowBlank: false,
blankText:'小类不能为空!',
store : store3
}]
} ]
});