Integration of "ExtJS" Formpanel with ComboBox and the acquisition of values

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.