jqgrid 에서 export execl 붙이기

필수로 불러 와야 한다 jqgrid는 최신 버젼을 사용 해야 한다 jqGrid Export to CSV, PDF, Excel




<script type="text/javascript" language="javascript" src="//cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>

필수로 불러 와야 한다
jqgrid는 최신 버젼을 사용 해야 한다


<!DOCTYPE html><html lang="en"><head>
<!-- The jQuery library is a prerequisite for all jqSuite products -->
<script type="text/ecmascript" src="../../../js/jquery.min.js"></script>
<!-- This is the Javascript file of jqGrid -->
<script type="text/ecmascript" src="../../../js/trirand/src/jquery.jqGrid.js"></script>
<!-- This is the localization file of the grid controlling messages, labels, etc.
<!-- We support more than 40 localizations -->
<script type="text/ecmascript" src="../../../js/trirand/i18n/grid.locale-en.js"></script>
<script type="text/javascript" language="javascript" src="//cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
<!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom -->
<link rel="stylesheet" type="text/css" media="screen" href="../../../css/jquery-ui.css" />
<!-- The link to the CSS that the grid needs -->
<link rel="stylesheet" type="text/css" media="screen" href="../../../css/trirand/ui.jqgrid.css" />
<meta charset="utf-8" />
<title>jqGrid Export to CSV, PDF, Excel</title></head><body>

<table id="jqGrid"></table>
<button id="export">Export to Excel</button>

<script type="text/javascript">
$(document).ready(function () {
$("#jqGrid").jqGrid({
url: 'data.json',
datatype: "json",
colModel: [
{ label: 'Category Name', name: 'CategoryName', width: 75 },
{ label: 'Product Name', name: 'ProductName', width: 90 },
{ label: 'Country', name: 'Country', width: 100 },
{ label: 'Price',
name: 'Price',
width: 80,
sorttype: 'number',
//formatter: 'number',
align: 'right'
},
{ label: 'Quantity', name: 'Quantity', width: 80, sorttype: 'integer', formatter : 'integer', formatoptions : {thousandsSeparator : ' '} }
],
loadonce: true,
viewrecords: true,
footerrow: true,
userDataOnFooter: true, // use the userData parameter of the JSON response to display data on footer
width: 780,
height: 200,
rowNum: 150
});
$("#export").on("click", function(){
$("#jqGrid").jqGrid("exportToExcel",{
includeLabels : true,
includeGroupHeader : true,
includeFooter: true,
fileName : "jqGridExport.xlsx",
maxlength : 40 // maxlength for visible string data
})
})
});

</script>


</body></html>

댓글

이 블로그의 인기 게시물

자바 string 비교 할때 equlas 를 사용하자

flutter webview scroll 안되는 경우 gestureRecognizers: gestureRecognizers, 추가 해서 되었다