日期:2014-05-16  浏览次数:20325 次

How to get dispayfield in extjs combo?

转:http://stackoverflow.com/questions/5680330/how-to-get-dispayfield-in-extjs-combo

?

Use the value to get the record out of the store, and get the display value from there.

Abstractly, you can use this code, but you might substitute some of the variables for known values to make it more readable:

getComboDisplay =function(combo){var value = combo.getValue();var valueField = combo.valueField;var record;
    combo.getStore().each(function(r){if(r.data[valueField]== value){
            record = r;returnfalse;}});return record ? record.get(combo.displayField):null;}