JS代码如下
Ext.onReady( function(){
var urls = '/struts2-1.6/forminfoaction-json!setlist.action';
var formPanel = new Ext.form.FormPanel({
labelAlign:'right',
title:'form',
labelWidth:50,
frame:true,
width:220,
url:'10-01.txt',
reader: new Ext.data.JsonReader({
root: 'data'
},[
{name: 'names',mapping:'names',type:'string'}
]),
items:[{
xtype: 'textfield',
fieldLabel: '文本',
name: 'names'
}],
buttons:[{
text:'读取',
handler:function(){
formPanel.getForm().load({url:urls, waitMsg:'Saving Data...'});
}
}]
});
formPanel.render("form");
});
JSON返回值
{"data":{"names":"form赋值"}}
点击了“读取”按钮后,form中的控件还是没有办法赋值上去。
网上资料找了不少,貌似我代码没写错啊,为啥不行呢。。 :cry: :cry:
[b]问题补充:[/b]
还是不行啊,关键地方没写错啊 :cry: :cry:
[b]问题补充:[/b]
'10-01.txt'也是一个json字符串,我单独写的文本。不过一样不行。。