Several minor issues to be aware of in ComboBox: Value running, value display, get input value

Source: Internet
Author: User

In Extjs, there will always be some minor issues when using ComboBox. I cannot find out the reason for this problem for a long time. The following are some notes ..

1. After the ComboBox loads data, the value in the ComboBox cannot be correctly mapped to the ComboBox.
Cause: because the value of name is to be passed to the server and the hidden property hiddeName is used to pass the value, the name of hiddenName must be the same as that of name. If the id and name are set to the same, they cannot be correctly matched. Therefore, the comboBox id and name cannot be set the same
New Ext. form. ComboBox ({
Id: "comboId ",
Name: "comboName ",
HiddenName: "comboName"
});

// Note: After the HiddenName attribute is added, the ComboBox is its id, and the result is the display value ..

2. The second problem is that after the data has been loaded, there are also values in the store, and it is not displayed in ComboBox. Please note whether valueField and displayField are set in your ComboBox, valueField is bound to the current underlying data, which is equivalent to its id and displayValue. It is bound to the nouns corresponding to the current underlying data, as the name suggests, that is, the displayed value. Also, check whether the ing and field are correctly written. If these two attributes do not exist, the values cannot be displayed. Another point is that the value obtained is passed back from the server, so remember to have response. getWrite (). print (json format value); sometimes the foreground is correctly written, but there is still no value, that is, the value is not uploaded to the foreground

Store: new Ext. Data. Store ({

Proxy: new Ext. Data. httpProxy ({}),

Reader: new Ext. data. JsonReader ({});

Field: ["valueid", "displayName"]

});

New Ext. form. ComboBox ({
Id: "comboId ",
Name: "comboName ",
HiddenName: "comboName ",

Store: store

ValueField: "valueid", // it must correspond to the field, otherwise it cannot match correctly

DisplayField: "dispalyField"
});

3. Obtain the manually entered value of ComboBox. The manually entered value is not completely set to the value in ComboBox. Therefore, when we get the value, it is an empty string.

Listeners :{
Render: function (f ){
F. el. on ('keyup', function (e ){
F. setValue (f. getRawValue ());
VipStore. proxy = new Ext. data. HttpProxy ({
Url: "vip_realtimeVipName.action? VipID ="
+ F. getRawValue ()
});
VipStore. load ();
});
}

These problems will always be encountered accidentally. Pay more attention to them ..

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.