Home >Web Front-end >JS Tutorial >Learn common methods of ExtJS TextField_extjs

Learn common methods of ExtJS TextField_extjs

WBOY
WBOYOriginal
2016-05-16 18:45:23989browse

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

Copy code The code is as follows:
Ext.onReady(function (){
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()) ;
}
}) ;
}) ;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn