extjs tree 事件

extjs tree 事件

点击的时候刷新:focus;

选中节点:select;

双击:itemdblclick

编辑:keyup, keydown, press(使用该监听,需要同事使用属性enableKeyEvents: true)

示例1 focus:

var listeuserComboStore = Ext.create(‘Ext.data.Store’, {
fields: [‘label’, ‘value’],
proxy : {
type : ‘ajax’,
url : ‘exnoticecomboExnotice.action’,
reader : {
type : ‘json’,
root : ‘root’
}
},
listeners: {
beforeload: function(){
if(Ext.getCmp(‘listexamComboStore’)){
Ext.apply(this.proxy.extraParams,{
examid: Ext.getCmp(‘listexamComboStore’).getValue()
});
}
}
}
});

{
xtype: ‘combobox’,
fieldLabel: ‘考试’,
name:’form.eexamtitle’,
id:’typeinscoExamcombo’,
labelAlign : ‘right’,
labelWidth: 60,
store: listexamComboStore,
queryMode: ‘local’,
displayField: ‘label’,
valueField: ‘value’,
listeners: {
‘focus’: function(){
listexamComboStore.removeAll();
listexamComboStore.load();
}
},
width: 350
}

示例2 编辑时同步刷新(例如输入nam,动态加载以nam为前缀或包含该字母的数据):

 

var listeuserComboStore = Ext.create(‘Ext.data.Store’, {
fields: [‘label’, ‘value’],
proxy : {
type : ‘ajax’,
url : ‘exusercomboExnotice.action’,
reader : {
type : ‘json’,
root : ‘root’
}
},
listeners: {
beforeload: function(){
Ext.apply(this.proxy.extraParams,{
papid: papid
});
if(Ext.getCmp(‘typeinscoExamcombo’)){
Ext.apply(this.proxy.extraParams,{
examid: Ext.getCmp(‘typeinscoExamcombo’).getValue()
});
}
if(Ext.getCmp(‘typeinscoEusercombo’)){
var typeduser = Ext.getCmp(‘typeinscoEusercombo’).getValue();
Ext.apply(this.proxy.extraParams,{
typeduser:typeduser
});
}
if(Ext.getCmp(‘typeinscoSEusercombo’)){
var typeduser = Ext.getCmp(‘typeinscoSEusercombo’).getValue();
Ext.apply(this.proxy.extraParams,{
typeduser:typeduser
});
}
}
}
});

{
xtype: ‘combobox’,
fieldLabel: ‘人员’,
name:’form.account’,
id:’typeinscoEusercombo’,
labelAlign : ‘right’,
labelWidth: 60,
store: listeuserComboStore,
queryMode: ‘local’,
displayField: ‘label’,
valueField: ‘value’,
allowBlank : false,
blankText : ‘请选择考试人员’,
enableKeyEvents: true,
listeners: {
‘focus’: function(){
listeuserComboStore.removeAll();
listeuserComboStore.load();
},
‘keyup’: function(){
listeuserComboStore.removeAll();
listeuserComboStore.load();
}
},
width: 350
}

This entry was posted in Computer, Java. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s