jqgrid 新增 excel 导出本地数据实例
This commit is contained in:
9149
common/src/main/resources/static/jszip/2.5/jszip.js
Normal file
9149
common/src/main/resources/static/jszip/2.5/jszip.js
Normal file
File diff suppressed because it is too large
Load Diff
4
common/src/main/resources/static/jszip/2.5/jszip.min.js
vendored
Normal file
4
common/src/main/resources/static/jszip/2.5/jszip.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -11,6 +11,7 @@
|
||||
<a href="${ctx}/test/testData/form" class="btn btn-default btnTool" title="${text('新增数据')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
|
||||
<% } %>
|
||||
<a href="#" class="btn btn-default" id="btnTrunsTest" title="事务测试"><i class="fa fa-refresh"></i> 事务测试</a>
|
||||
<a href="#" class="btn btn-default" id="btnExport" title="导出数据"><i class="glyphicon glyphicon-export"></i> 导出数据</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
@@ -119,12 +120,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<script src="${ctxStatic}/jszip/2.5/jszip.min.js?${_version}"></script>
|
||||
<script>
|
||||
// 初始化DataGrid对象
|
||||
$('#dataGrid').dataGrid({
|
||||
searchForm: $("#searchForm"),
|
||||
columnModel: [
|
||||
{header:'${text("单行文本")}', name:'testInput', index:'a.test_input', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
|
||||
{header:'${text("单行文本")}', name:'testInput', index:'a.test_input', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
|
||||
if (obj.exporttype == "excel") { return val||'' };
|
||||
return '<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" data-title="${text("编辑数据")}">'+(val||row.id)+'</a>';
|
||||
}},
|
||||
{header:'${text("多行文本")}', name:'testTextarea', index:'a.test_textarea', width:150, align:"left"},
|
||||
@@ -152,7 +155,7 @@ $('#dataGrid').dataGrid({
|
||||
{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', firstsortorder:'desc', width:150, align:"center"},
|
||||
{header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
|
||||
{header:'${text("操作")}', name:'actions', width:200, sortable:false, title:false, formatter: function(val, obj, row, act){
|
||||
var actions = [];
|
||||
var actions = []; if (obj.exporttype == "excel") { return val||'' };
|
||||
<% if(hasPermi('test:testData:edit')){ %>
|
||||
actions.push('<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" title="${text("编辑数据")}"><i class="fa fa-pencil"></i></a> ');
|
||||
if (row.status == Global.STATUS_NORMAL){
|
||||
@@ -216,7 +219,8 @@ $('#dataGrid').dataGrid({
|
||||
ajaxSuccess: function(data){
|
||||
// if (data.count == 0){
|
||||
// $("#dataGrid").parent().append("<div class=\"ml10\">没有符合数据</div>");
|
||||
// }
|
||||
// }
|
||||
window.dataList = data.list;
|
||||
}
|
||||
});
|
||||
$("#btnTrunsTest").click(function(){
|
||||
@@ -226,4 +230,10 @@ $("#btnTrunsTest").click(function(){
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$("#btnExport").on("click", function(){
|
||||
$('#dataGrid').dataGrid('setParam', {data: dataList}).dataGrid("exportToExcel",{
|
||||
fileName: "数据列表.xlsx",
|
||||
maxlength: 40
|
||||
});
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user