Im learning Extjs and have a problem , when i try to append new text to an item i get an error same goes for getValue
. getValue
相同。 When i try setVisible
it works like it should be.
Ext.Loader.setConfig({enabled:true});
Ext.application({
name: 'app',
controllers:[
],
appFolder: 'app',
launch: function() {
var panel = new Ext.form.FormPanel({
renderTo:Ext.getBody(),
title:'Panel',
width:400,
bodyPadding: 10,
autoHeight:true,
items:[{
xtype:'textareafield',
name: 'textInput',
id:'textId',
value:'why not'
},{
xtype:'button',
text:'Helllo',
handler:function(){
console.log('button click')
var tf = Ext.get('textId');
tf.setValue('This should change!')
}
}],
});
}
});
Thanks
That's because Ext.get()
will return an Ext.Element
.
What you want to use is Ext.getCmp('textId')
which will return the component.
The Element is basically the Ext wrapper round the Dom element, so it has methods like setVisible, but you want to get the text area component, which has all the methods you're after.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.