Use Combobox to select values in ExtJS PropertyGrid

Source: Internet
Author: User

Problem description:
When Combobox is used in PropertyGrid to select a value, the value of displayField is obtained, but the value of valueField is displayed when you confirm the selection. For example, select gender from the drop-down list, displayField is 'male', 'female ', and valueField is '0' and '1' respectively. Therefore, the Chinese description should be displayed, however, the data is displayed as 0 or 1, which is unacceptable to users.

Solution:
Block the beforepropertychange event of the Grid, set the displayed value, and return false to prevent verification resetting in the modification event.
For example:
Copy codeThe Code is as follows:
Listeners :{
Beforepropertychange: function (source, recordId, value, oldValue ){
If (recordId = 'brand _ name '){
Var record = this. getStore (). getById (recordId );
This. suspendEvents ();
Record. set ("value", cmbBrandEdit. store. getAt (cmbBrandEdit. store. find ('brand _ id', value). get ('brand _ name '));
Record. commit ();
This. resumeEvents ();
Return false;
}
}
}

Related Article

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.