关于EXTJS问题,请问各位大手们在下遇到一个在做新增操作的时候有一条数据是从后台获取过来的下拉框数据
遇到如下问题'this.store'为空或不是对象,请看代码://下拉框varcomboRecord=newExt.data.Record.create([{name:"...
遇到如下问题 'this.store' 为空或不是对象,请看代码:
// 下拉框
var comboRecord = new Ext.data.Record.create([{
name: "Id"
}, {
name: "Departments"
}]);
var comboStore = new Ext.data.Store({
autoLoad: true, // 自动加载
proxy: new Ext.data.HttpProxy({
url: "../CommControl/CommHandler.ashx?action=Department",
// url: "Data/User/UserManage.aspx?mode=combo",
method: "POST"
}),
reader: new Ext.data.JsonReader({
root: "data",
id: "Id"
}, comboRecord)
});
下面是定义:
items : [
{
width: 100,
emptyText: "请选择",
id: 'factory_code',
mode: "remote",
triggerAction: "all",
valueField: "Id",
displayField: "Departments",
readOnly: true,
xtype: 'combo',
store: comboRecord
},
是这样的,您有兴趣可以对比下:
// 下拉框
var comboRecord = new Ext.data.Record.create([{
name: "Id"
}, {
name: "Departments"
}]);
var brigadeStore = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url: "../CommControl/CommHandler.ashx?action=Department",
method : "POST"
}),
root:"data",
id: "Id",
reader: new Ext.data.JsonReader({
root: "data",
id: "Id"
}, comboRecord)
});
其他的就是 在items里面的调用brigadeStore方法了 展开
// 下拉框
var comboRecord = new Ext.data.Record.create([{
name: "Id"
}, {
name: "Departments"
}]);
var comboStore = new Ext.data.Store({
autoLoad: true, // 自动加载
proxy: new Ext.data.HttpProxy({
url: "../CommControl/CommHandler.ashx?action=Department",
// url: "Data/User/UserManage.aspx?mode=combo",
method: "POST"
}),
reader: new Ext.data.JsonReader({
root: "data",
id: "Id"
}, comboRecord)
});
下面是定义:
items : [
{
width: 100,
emptyText: "请选择",
id: 'factory_code',
mode: "remote",
triggerAction: "all",
valueField: "Id",
displayField: "Departments",
readOnly: true,
xtype: 'combo',
store: comboRecord
},
是这样的,您有兴趣可以对比下:
// 下拉框
var comboRecord = new Ext.data.Record.create([{
name: "Id"
}, {
name: "Departments"
}]);
var brigadeStore = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url: "../CommControl/CommHandler.ashx?action=Department",
method : "POST"
}),
root:"data",
id: "Id",
reader: new Ext.data.JsonReader({
root: "data",
id: "Id"
}, comboRecord)
});
其他的就是 在items里面的调用brigadeStore方法了 展开
3个回答
展开全部
store: comboRecord
----------这里用comboStore
试试
----------这里用comboStore
试试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
看代码应该是对的,JsonReader中最好是从后台直接传一个jsonList形式的字符串过来,不要root: "data"这个了,我之前也遇到这问题好像就是这样改的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询