Home > Article > Web Front-end > Learn common methods of ExtJS TextField_extjs
1. Attribute
fieldLabel: label name.
labelWidth: label width.
ID: File box ID.
2. Construction parameters
listeners: Bind a series of events before the object is initialized.
3. Function
getCmp(string _id): Get the component object with id _id.
getValue(): Get the file box value.
4. Others
layout: Only in this layout can the label name of the file box be displayed correctly. The host object of the layout must be Ext.Container or Ext A subclass of .Container.
When applying FormLayout layout, just specify layout: "form" in the construction parameter of the host object.
5. Application examples
var _panel = new Ext.Panel({
renderTo:Ext.getBody(),
layout:"form",
labelWidth:30,
listeners:{
"render":function(_panel){
_panel.add(new Ext.form.TextField({
id: "txt_name",
fieldLabel: "Name"
})) ;
}
}});
new Ext.Button({
text:"OK",
renderTo:Ext.getBody(),
handler:function(){
alert(Ext.getCmp("txt_name").getValue()) ;
}
}) ;
}) ;