住家阿呆

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

一、后台方法

1.复制ExportController至项目内作为通用导出控制

@RequestParam(value = "exportid") String exportid,//配置文件中定义的调用参数的key前缀
@RequestParam(value = "exportheaders") String headers,
@RequestParam(value = "exportfilename") String filename,
@RequestParam(value = "exporttype") String type

以上4个参数为必要元素

2.定义CommonResourse.properties中导出所指向的取数类及方法

####
001.class=com.intime.model.workflow.impl.ExportServiceImpl
001.method=queryGroupTypeList

二、前端调用方法

1.调用common.export.jsp

<script src="lib/js/common.export.js?t=<%=versioncode %>" type="text/javascript"></script>

2.页面定义按钮

<div class="searchbutton">
      <input type="button" id="search" value="查询" />
      <input type="reset" value="重置"/>
      <input type="button" id="export" value="导出" />
</div>

红色为示例按钮

3.js中定义导出

$.common.export({
    expid:"001",
    btn:"#export",
    type:"xls",
    firstrow:null,
    lastrow:null,
    action:"<%=basePath%>export.htm",
    form:"#searchform",
    grid:"#gridcontent",
    filename:"测试"
})

参数解释如下:

common.export
expid 后端配置文件中的对应的导出编号,前端与后端需约定好
btn  页面中定义的导出按钮的id,使用#
 type  导出类型,现只支持xls
 firstrow  默认无
 lastrow  最后一行,可自定义内容,字段需和jqgrid匹配(默认无)
 action  导出后台url
 form

 指向的查询formID,使用#

 grid  指向的jqgrid的ID,使用#
 filename  导出的命名
   
posted on 2016-03-04 09:45  住家阿呆  阅读(318)  评论(0编辑  收藏  举报