EXTJS3 combobox take value and text case detailed _extjs

Source: Internet
Author: User


When using ComboBox, it has a Hiddenname property that is dedicated to submitting values for value in ComboBox.
It is assumed that a ComboBox ID is the value of the Comboid,hiddenname property is Hiddenvalue,
Then, use the Ext.get (' comboid '). The Dom.value method gets the text value of the selected item in the ComboBox.
and using Ext.get (' Hiddenvalue '). Dom.value gets the value that is required to be submitted in ComboBox.
EXT.GETCMP ("id value"). GetValue (), Fetch value value
. replace (/\s/g, ""); Removes all line wraps, spaces, and tabs in JSON text;
=========================================
ExtJS executes the Click event of the button and executes the handler event
The easiest way to do this is to see the corresponding generated IDs found inside the ExtJS generated HTML code DOM.
For example:
Method 1:

Copy Code code as follows:

var btn = document.getElementById ("ext-gen40")//The ext-gen40 here is the ID generated by ExtJS but sometimes the ID changes,
Btn.click ();

Method 2:
Copy Code code as follows:

EXT.GETCMP (' title2d '). FireEvent ("click"); The "title2d" here is the ID in the ExtJS code

To perform a button handler event:
Copy Code code as follows:

var btn2d = ext.getcmp ("title2d");
Btn2d.handler.call (Btn2d.scope, btn2d);

Reference URL: http://www.sencha.com/forum/showthread.php?25677-2.0.1-fireEvent%28-click-%29-on-buttons-don-t-call-handler-function
OnClick is a method, and handler is a configuration item
The difference between ExtJS onclick and handler: http://blog.csdn.net/21aspnet/article/details/6865571
====================================================== gets the value of the text box
1. HTML text box
Such as:
Copy Code code as follows:

<input type= "text" name= "test" id= "Test" >

Get values in the following ways:
Copy Code code as follows:

var tValue = ext.getdom (' Test '). Value;

Or
Copy Code code as follows:

var tValue = document.getElementById (' Test '). Value

2, ExtJS components
Such as:
Copy Code code as follows:

{
ID: ' Test ',
Xtype: ' TextField ',
Fieldlabel: ' Test ',
Name: ' Test ',
width:370
}

Get values in the following ways:
Copy Code code as follows:

var tValue = ext.getcmp (' Test '). GetValue ();
Ext.get (' Test '). Dom.value

Set the value of a text box
Copy Code code as follows:

EXT.GETCMP (' Test '). SetValue ("set value");

Enable and disable the ============================== button
Copy Code code as follows:

EXT.GETCMP (' BTNQC '). disable ();//Disabled
EXT.GETCMP (' BTNQC '). Enable ()//Enabled

Method 1: You can define the Bbar button directly to the property, Hidden:true property, you can hide; Disabled:true property, you can disable Method 2: Add an ID to the button, such as ID: ' BTN '; then call ext.getcmp in the Panel event (' BTN '). disable (); Disable or ext.getcmp (' btn '). Enable (); EXT.GETCMP (' btn '). setvisible (false); hide or ext.getcmp (' btn '). setvisible (True);

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.