1.后台返回传一个泛型集合List<xxx>
public ActionResult AddCarMsg()
{
List<Brand> brands = BrandManager.GetAllBrand();
ViewData["brands"] = Json(brands);
return View();
}2.前台要把brands绑定到combobox上
非关键代码省略:
............. var LeaveForm = new Ext.FormPanel({
width: 360,
frame: true,
renderTo: AddCarMsg,
title: "添加车辆信息",
bodyStyle: "padding:5px 5px 0",
id: "addCarForm",
items: [
{
xtype: "combo",
name: 'brand',
store: //这里应该如何绑定? fieldLabel: "品牌",
emptyText: '请选择品牌' },
.............请教
public ActionResult AddCarMsg()
{
List<Brand> brands = BrandManager.GetAllBrand();
ViewData["brands"] = Json(brands);
return View();
}2.前台要把brands绑定到combobox上
非关键代码省略:
............. var LeaveForm = new Ext.FormPanel({
width: 360,
frame: true,
renderTo: AddCarMsg,
title: "添加车辆信息",
bodyStyle: "padding:5px 5px 0",
id: "addCarForm",
items: [
{
xtype: "combo",
name: 'brand',
store: //这里应该如何绑定? fieldLabel: "品牌",
emptyText: '请选择品牌' },
.............请教
还要给他一个reader ,让它知道如何去阅读返回的数据
在前台 store的url指向这个地址
就可以, Json格式数据 如:[{name:"张三"},{name:"李四"}]
autoLoad:true,
proxy:new Ext.data.HttpProxy({
url:"findAllUser.action"
}),
fields:["name"]
});xtype:"combo",
emptyText:"选择网络客服",
id:"myweb",
mode:"remote",
selectOnFocus:true,
loadingText:"正在加载数据",
triggerAction:"all",
displayField:"name",
store:findAllUserStore