Home  >  Article  >  Web Front-end  >  Problem using Combobox to select value in ExtJS PropertyGrid_extjs

Problem using Combobox to select value in ExtJS PropertyGrid_extjs

WBOY
WBOYOriginal
2016-05-16 18:25:08741browse

Problem description:
When using Combobox to select a value in the PropertyGrid, the value of the displayField should be obtained, but when confirming the selection, the value of the valueField is displayed. For example, when selecting gender in the drop-down menu, the displayField is 'Male'. 'Female', the corresponding valueFields are '0' and '1' respectively. The original selection should display Chinese description, but instead it displays identification data such as 0 or 1, which should not be acceptable to users.

Solution:
Intercept the Grid's beforepropertychange event, set the displayed value, and then return false to prevent the validation reset in the modification event.
For example:

Copy code The 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;
}
}
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn