在JSP页面的<script type="text/javascript">中写EXTJS
Ext.ns("Ext.sfgy.firstPage.topImage"); // 自定义一个命名空间
topImage = Ext.sfgy.firstPage.topImage; // 定义命名空间的别名
......
topImage = {
getModule: ctx + '/system/module/getModule',
all : ctx + '/system/sfgyimage/all',// 加载所有
save : ctx + "/system/sfgyimage/save",//保存
update : ctx + "/system/sfgyimage/update",//修改
del : ctx + "/system/sfgyimage/del",//删除
pageSize : 20, // 每页显示的记录数
ISDISPLAY:eval('(${modules.isDisplay==null?"{}":modules.isDisplay})'),
MODULEID : '${param.moduleID}'
};
topImage.moduleBox = new Ext.data.JsonStore({//对应类别store
url: topImage.getModule,//请求路径
idProperty: 'moduleId',
fields:[{
name:'moduleId',
mapping:'moduleId'
},{
name:'moduleName',
mapping:'moduleName'
}]
});
/**所属项目*/
topImage.itemTypeCombo = new Ext.form.ComboBox({
fieldLabel : '所属项目',
displayField:'moduleName',
valueField: 'moduleId',
name : 'itemUrlName',
hiddenName : 'itemUrl',
triggerAction : 'all',
mode : 'remote',
store : topImage.moduleBox,
editable : true,
anchor : '99%'
});
panel中直接用topImage.itemTypeCombo调用即可
后台返回正常的List数据即可,无需转成json串
效果图如下:
这种做法,只在第一次点击时发生查询请求,之后不刷新页面不会重复发送