var Formpanel = ext.create ("Ext.form.Panel", {
Title: ' Formpanel ',
width:400,
URL: ' asd.php '//default via AJAX submission to this URL
Layout: ' anchor ',//layouts fill the entire width
Defaults: {
Anchor: ' 100% '
},
Items: [{
Xtype: ' TextField ',//text editing
Fieldlabel: ' FirstName ',
Name: ' First ',
Allowblank: ' True '
},{
Xtype: ' Combo ',//combobox
ID: ' Cmbid ',
Fieldlabel: ' Cmbname ',
Store:new Ext.data.SimpleStore ({
Fields: [' value ', ' text '],
Data: [
[1, ' name1 '], [2, ' name2 '], [3, ' Name3 '], ...
]
}),
Querymode: ' Local ',
Displayfield: ' Text ',
Valuefield: ' Value ',
RenderTo:Ext.getBody ()
}],
Buttons: [{
Text: ' Reset ',
Handler:function () {
This.up (' form '). GetForm (). reset ();
}
},{
Text: ' Save ',
Handler:function () {
var textvalues =this.getvalues () [' first ']; Gets the value of the edit box, according to ' name '
var cmbvalues = ext.getcmp (' cmbid '). GetValue (); Gets the value of the ComboBox, based on the ' ID '
...
}
}]
});
1, about getting the values of the components within the Formpanel, This.getvalues () Gets all the form fields in the form that are currently worth the shortcut functions. and call This.getform (). GetValues () returns the same result.
2, for Get (), GetDOM (), getcmp (), GetBody (), Getdoc () the difference:
Get (Id/obj):
The Get method is used to get an EXT element, that is, an object of type Ext.element, the Ext.element class is an ext-dom wrapper, representing the elements of the DOM, which creates a corresponding element object for each DOM, which can be passed through the element object method to implement the actions specified on the DOM, such as hiding elements with the Hide method, INITDD methods to allow the specified DOM to have drag-and-drop characteristics, and so on. The Get method is actually a shorthand form of Ext.Element.get. There is only one parameter in the Get method, which is a mixed parameter, which can be the ID of the DOM node, an element, or a DOM node object.
GetDOM (id/obj):
The GetDOM method can get the DOM node in the document, which contains a parameter that can be the ID of the DOM node, the DOM node object, or the ext element (element) of the DOM node.
GETCMP (ID):
The getcmp method is used to obtain an ext component, with only one parameter in the GETCMP method, which is the ID of the component.
GetBody ():
Gets the body node element of the document.
Getdoc ():
For the ext element (element) corresponding to document, the Getdoc method essentially gets the current HTML document object, which is the Element object that encapsulates the document object as a ExtJS.
ExtJS Formpanel Integration with ComboBox and the acquisition of values