ExtJs Combobox绑值问题
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
},
...........
急等高手解决!!!
相关推荐
ExtJS PropertyGrid中使用Combobox选择值问题
在PropertyGrid中使用Combobox来选择值时,得到的应该是displayField的值,但是在确认选择的时候却显示了valueField的值
extjs4 ComboBox 点击下拉框 出现grid效果
extjs4 ComboBox 点击下拉框 出现grid效果 这里只实现了点击下拉框显示gird,点击其他地方grid自动消失
extjs editgrid combobox 回显
extjs editgrid combobox 回显extjs editgrid combobox 回显extjs editgrid combobox 回显extjs editgrid combobox 回显
Extjs EditorGridPanel中ComboBox列的显示问题
为了解决这个问题需要在EditorGridPanel的ColumnModel中显示ComboBox的地方使用renderer属性,重新渲染,方法如下: 代码如下: //部门列表 var comboxDepartmentStore = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: “GetDepartmentJson.aspx”, method: ‘GET’ }), reader: new Ext.data.JsonReader({ root: ‘data’, totalProperty: ‘totalCount’, fie
ExtJS4给Combobox设置列表中的默认值示例
这个是model 代码如下: Ext.regModel(‘commemModel’, { fields : [ ‘name’, ‘id’ ] }); 定义一个store设置id为s1的容器的默认值是 第一季度 代码如下: var gjcx1 = new Ext.data.Store({ autoLoad:true, model : commemModel, proxy : { type : ‘ajax’, url : ‘../store/cxjd.json’ }, listeners :{ load:function(){ Ext.getCmp(‘s1’).setValue(‘q1’);


