ExtJs Combobox绑值问题

qzw4549689 qzw4549689 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
1.后台代码:
public ActionResult GetBrandMsg()
{
//获取所有品牌
List<Brand> brands = BrandManager.GetAllBrand();
string jsonStr = "";
for (int i = 0; i < brands.Count; i++)
{
if (i == brands.Count - 1)
{
jsonStr += "{'brandName':'" + brands[i].BrandName + "','brandId':" + brands[i].Id + "}";
}
else
{
jsonStr += "{'brandName':'" + brands[i].BrandName + "','brandId':" + brands[i].Id + "},";
}
}
//1.不知道这样返回有没问题
return Json("{" + jsonStr + "}");
}

2.前台关键代码:
...........

Ext.onReady(function() {
var myStore = new Ext.data.JsonStore({
autoLoad: true,
proxy: new Ext.data.HttpProxy({
url: "Car/GetBrandMsg"
}),
fields: ["brandName"]
});
//这里弹出来是[object Object] alert(myStore);
//提示信息初始化
Ext.QuickTips.init();
//提示方式
Ext.form.Field.prototype.msgTarget = 'side';
//生成表单
var LeaveForm = new Ext.FormPanel({
width: 360,
frame: true,
renderTo: AddCarMsg,
title: "添加车辆信息",
bodyStyle: "padding:5px 5px 0",
id: "addCarForm",
items: [
{
xtype: "combo",
name: 'brand',
model: "remote",
displayField: "brandName",
fieldLabel: "品牌",
emptyText: '--请选择品牌--',
store: myStore, width: 200
},

...........

急等高手解决!!!
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
qzw4549689
JavaScript 87,983 成员 224,680 内容