欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

gridpanel动态加载数据的实例代码_javascript技巧

程序员文章站 2022-04-18 14:16:11
...
复制代码 代码如下:


public void getTagModelDataList(ActionMapping mapping, ActionForm actionform,HttpServletRequest request, HttpServletResponse response){
ITagModelManager tagmgr = this.getPkgServer().getDriver().getOperateServer().getTagModelManager() ;
List> models = new ArrayList>();
String tagModelKeyword = request.getParameter("tagModelKeyword");
List tagModels ;
tagModels = tagmgr.getEssTagModels() ;
int resultSize = 0 ;
if (null != tagModels && !tagModels.isEmpty()){
//数据分页显示
resultSize = tagModels.size() ;
String start = request.getParameter("start") ;
String perPage = request.getParameter("limit") ;
String esType ="";
if (null != start && null != perPage){
int fromIdx = Integer.parseInt(start);
int per = Integer.parseInt(perPage);
int toIdx = fromIdx + per ;
if (toIdx > resultSize) toIdx = resultSize ;
tagModels = tagModels.subList(fromIdx,toIdx) ;
}
for(EssTagModel etm : tagModels){
HashMap map = new HashMap();
map.put("id", Long.toString(etm.getId())) ;
map.put("esidentifier", etm.getEsidentifier()) ;
map.put("estype", etm.getEstype()) ;
map.put("esdescription", etm.getEsdescription()) ;
map.put("esorder", Long.toString(etm.getEsorder())) ;
map.put("metadata", etm.getMetadata()) ;
models.add(map) ;
}
}
JSONObject json = new JSONObject();
JSONArray ary = new JSONArray(models);
json.put("tagModelList", ary);
json.put("resultSize",resultSize);
writeJson(response, json.toString()) ;
}
public void getParams(ActionMapping mapping, ActionForm actionform,HttpServletRequest request, HttpServletResponse response){
LinkedHashMap tags = new LinkedHashMap() ;
tags.put("id", "id") ;
tags.put("esidentifier", "字段") ;
tags.put("estype", "类型") ;
tags.put("esdescription", "描述") ;
tags.put("esorder", "顺序") ;
tags.put("metadata", "元数据") ;
tags.put("esisnull", "是否为必填项") ;
tags.put("eslength", "字段长度") ;
tags.put("esdotlength", "小数点位数") ;
tags.put("esissystem", "是否为系统字段") ;
JSONObject json = new JSONObject();
json.put("record", getJsonRecord(tags)) ;
json.put("tagModelManager_tagModelColumnModels", getJsonColumnModel(tags)) ;
writeJson(response,json.toString());
}