ext4.02 combobox动态加载数据问题

毛豆先生Max 2011-09-03 05:03:19
基本架构是ssh2,页面部分用到了ext,需要从后台读取数据,本人初学ext,高手们赶快出来帮帮我吧,以下是主要代码部分
页面部分:combobox部分

{
xtype:'combo',
store:new Ext.data.Store({
proxy:new Ext.data.HttpProxy({url:'enterprise_getEnterpriseStore'}),
reader:new Ext.data.JsonReader({root:'root'},[{name:'name',mapping:'name'}])
}),
valueField:'name',
displayField:'name',
loadingText:'Loading...',
mode:'remote',
typeAhead: true,
forceSelection:true,
allowBlank:false,
blankText:'请选择旅行社!',
msgTarget:'side',//可用的值有qtip,title,under,side,[elementId]
name:'area',
hiddenName:'area',
editable:true,
triggerAction:'all',
fieldLabel:'旅行社',
anchor:'97%'
}

后台action:root是我定义的String类型的变量,提供了get、set方法

public String getEnterpriseStore() throws Exception {
List<HtEnterprise> list = enterpriseServ.list(null);
root = "{root:[";
Iterator<HtEnterprise> it = list.iterator();
while (it.hasNext()) {
root += "['name':'" + it.next().getName() + "'],";
}
root = root.substring(0, root.length() - 1);
root += "]}";
System.out.println(root);
return SUCCESS;
}

struts.xml:

<result type="json">
<param name="includeProperties">root</param>
</result>
...全文
326 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
毛豆先生Max 2011-09-05
  • 打赏
  • 举报
回复
没有人会吗?
毛豆先生Max 2011-09-04
  • 打赏
  • 举报
回复
高手们都去哪里了?
毛豆先生Max 2011-09-04
  • 打赏
  • 举报
回复
快来牛人啊

81,094

社区成员

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

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