首页  >  文章  >  web前端  >  gridpanel动态加载数据的实例代码_javascript技巧

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

WBOY
WBOY原创
2016-05-16 17:28:261135浏览
复制代码 代码如下:


    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());
}
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn