FileController 中的代码
public ActionResult FillTypeAll() {
IList<TypeInfo> types = TypeInfoService.SelectAll();
string result = TypeInfoService.ListToJson<TypeInfo>(types);
return this.Json(types);
}
var typeStores = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: '<%= Url.Action("AddCommInfoByFile", "File") %>'
}),
reader: new Ext.data.JsonReader({
totalProperty:"totalProperty",
root: "result",
fields:[{name:'Id'},{name:'TypeName'}]})
});
typeStores.load();
// alert("-399999--");
//定义下拉框
var txtCombo = new Ext.form.ComboBox({
id: "Id",
editable:true,
store: typeStores,
emptyText:'请选择',
mode: 'local',
typeAhead:true,
triggerAction:'all',
valueField:'Id',
displayField: 'TypeName',
selectOnFocus:true,
width: 200,
resizable:true
});
问题是,界面上显示的下拉框没有值,数据是能查询出来的。
{"TypeInfo":[{"Id":4,"TypeName":"aaa","TypePid":0,"TypeDesc":"类型1"},{"Id":5,"TypeName":"bbb","TypePid":0,"TypeDesc":"类型2"},{"Id":6,"TypeName":"ccc","TypePid":0,"TypeDesc":"类型3"}]}
return this.Json(result); 这个Action中应该是这个