首页 新闻 会员 周边

mvc2+EXT ComboBox的问题

0
悬赏园豆:50 [已关闭问题] 关闭于 2011-06-25 10:08

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中应该是这个

Agile45的主页 Agile45 | 初学一级 | 园豆:130
提问于:2011-05-15 15:37
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册