---
title: "ext comboBox 设置 displayFiled"
author: "kakarot_java"
date: "2010-07-08T21:52:24Z"
tags: []
categories: ["Web前端"]
slug: "ext-combobox-displayfiled"
draft: false
lastmod: "2010-07-08T21:52:24Z"
id: 708694
url: "https://kakarot-java.iteye.com/blog/708694"
---

```java

var zhishi = new Ext.form.ComboBox({
fieldLabel : '制式',
name : 'system',
emptyText:'请选择...',
readOnly : true,
valueField :'systemId',
displayField : 'systemLcName',
mode : 'local', // 必须

//triggerAction : 'all',
width : 140,
store : new Ext.data.Store({
autoLoad : true,
proxy : new Ext.data.HttpProxy({
url : 'ruleOper.do?action=getAllSystem',
method : "post"
}),
reader : new Ext.data.JsonReader({
root : 'list',
id : 'systemId'
}, [{
name : 'systemid'
}, {
name : 'systemlcname'
}])
})
});
zhishi.store.on('load',function(store,record,opts){   
   
var myvalue= record[0].data.systemId;//这种方法也可以获得第一项的值systemId,systemLcName都是reader 得
  var myrawvalue=record[0].data.systemLcName;
  zhishi.setValue(myvalue);
  zhishi.setRawValue(myrawvalue);
  });   


```