extjs formpanel panel.getForm.load();

guo779820919 2011-09-01 01:40:44
从数据库中读取数据绑定到formpanel中的表单上,可是我现在读不到数据,帮我看一下,代码是否有问题。谢了!

Ext.define('S3.Console.Envirrecord', {
constructor: function (dept_id, dept_desc, sensor_id, sensor_desc) {

/* var store = new Ext.data.JsonStore({
model: 'Envirrecordmodel',
autoLoad: true,
proxy: {
type: 'webservice',
url: 'core/WebService.asmx/LoadEnvirrecord',
params: { sensor_id: sensor_id, dept_id: dept_id },
root: 'items'

}
});*/
/*store.on('beforeload', function (store, operation) {

operation.params = {sensor_id: sensor_id, dept_id: dept_id };
});*/
var Panel = new Ext.form.FormPanel({


bodyStyle: 'position:relative;padding: 5px 5px;',
defaults: {
xtype: 'textfield'
},
reader: new Ext.data.JsonStore({
successProperty: 'success',
root: 'items'
}, [
{ name: 'sensor_desc', mapping: 'sensor_desc' },
{ name: 'dept_desc', mapping: 'dept_desc' },
{ name: 'refrigerator_type', mapping: 'refrigerator_type' },
{ name: 'Model', mapping: 'Model' },
{ name: 'Energy_dissipation', mapping: 'Energy_dissipation' },
{ name: 'Volume', mapping: 'Volume' },
{ name: 'refrigerator_life', mapping: 'refrigerator_life' },
{ name: 'repairnum', mapping: 'repairnum' },
{ name: 'marks', mapping: 'marks' }
]),
items: [{
name: 'sensor_desc',
fieldLabel: '探头名称',
id: 'sensor_desc',
allowBlank: false

}, {
name: 'dept_desc',
fieldLabel: '部门名称',
id: 'dept_desc',
allowBlank: false

}, {
name: 'refrigerator_type',
fieldLabel: '冰箱类型',
id: 'refrigerator_type',
allowBlank: false

}, {
name: 'Model',
fieldLabel: '型号',
id: 'Model',
allowBlank: false

}, {
name: 'Energy_dissipation',
fieldLabel: '耗能',
id: 'Energy_dissipation',
allowBlank: false

}, {

name: 'Volume',
fieldLabel: '容积',
id: 'Volume',
allowBlank: false

}, {
name: 'refrigerator_life',
fieldLabel: '使用年限',
id: 'refrigerator_life',
allowBlank: false

}, {

name: 'repairnum',
fieldLabel: '维修次数',
id: 'repairnum',
allowBlank: false

}, {

name: 'marks',
fieldLabel: '备注',
id: 'marks',
allowBlank: false

}
]
} );

Panel.getForm.load({
url: 'core/WebService.asmx/LoadEnvirrecord',
params: { sensor_id: sensor_id, dept_id: dept_id }
});
var win = Ext.create('Ext.Window', {
title: '仓储环境' + ' 部门:' + dept_desc + '(' + dept_id + ') 探头:' + sensor_desc + '(' + sensor_id + ')',

layout: 'fit',
modal: true,
width: 400,
height: 300,
autoScroll: false,
items: Panel
});
win.show();
}


});
...全文
390 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
leefwu 2011-09-02
  • 打赏
  • 举报
回复
FireFox用Firebug查看,一目了然
班门弄斧 2011-09-02
  • 打赏
  • 举报
回复

断点看下面url的返回值
url: 'core/WebService.asmx/LoadEnvirrecord'
另外注意大小写,之前就有人是因为大小写不一样,引起form不能正常加载,
比如:
前台formpanel中备注的name为marks,
而后台返回备注的字段为Marks
guo779820919 2011-09-02
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 leefwu 的回复:]
引用 6 楼 jsnt_rd 的回复:

JScript code

Panel.getForm.load
改为
Panel.load


同意楼上的
[/Quote]
getForm().load的括号我也加了,panel.load()我也试过了,还是不行。
leefwu 2011-09-02
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 jsnt_rd 的回复:]

JScript code

Panel.getForm.load
改为
Panel.load
[/Quote]

同意楼上的
leefwu 2011-09-02
  • 打赏
  • 举报
回复
试一下Panel.getForm().load({……
getForm()是方法,少了括号

另外最好是在FireFox下用FireBug看看有没有获取到数据,查看错误信息
班门弄斧 2011-09-02
  • 打赏
  • 举报
回复

Panel.getForm.load
改为
Panel.load
EEXXTTJJSS 2011-09-02
  • 打赏
  • 举报
回复
看下前台是不是报错了,
然后看下后台返回的数据格式是不是正确的。
guo779820919 2011-09-02
  • 打赏
  • 举报
回复
我现在加上了,还是获取不到数据呀!高手帮帮忙呀!
大哥-你真棒 2011-09-01
  • 打赏
  • 举报
回复

Panel.getForm().load({})///漏了一个括号吧
guo779820919 2011-09-01
  • 打赏
  • 举报
回复
url 是正确的。
24K純帥 2011-09-01
  • 打赏
  • 举报
回复
是不是因为URL不对啊~

87,989

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧