EasyUI
Export DataGrid
Extension » Export DataGrid
Include 'datagrid-export.js' file
Export DataGrid
Export PDF
The PDF document can be created using the pdfmake library.
Methods
The methods below extend from datagrid.
| Name | Parameter | Description |
|---|---|---|
| toHtml | rows | Export the html table. |
| toArray | rows | Export the array data. |
| toExcel | param |
Export to the excel file.
Code examples:
$('#dg').datagrid('toExcel', 'datagrid.xls');
$('#dg').datagrid('toExcel', {
filename: 'datagrid.xls',
worksheet: 'Worksheet'
});
// export with customized rows
$('#dg').datagrid('toExcel', {
filename: 'datagrid.xls',
worksheet: 'Worksheet',
caption: 'Caption',
fields: ['itemid','productid'],
rows: rows,
footer: [{
productid: 'Summary',
listprice: 30
},{
productid: 'Summary',
listprice: 40
}]
});
|
| toCsv | param |
Export to the csv file.
Code examples:
$('#dg').datagrid('toCsv', 'datagrid.csv');
// export with customized rows
$('#dg').datagrid('toCsv', {
filename: 'datagrid.csv',
fields: ['itemid','productid'],
rows: rows,
footer: [{
productid: 'Summary',
listprice: 30
},{
productid: 'Summary',
listprice: 40
}]
});
|
| title |
Print the datagrid.
Code examples:
$('#dg').datagrid('print', 'DataGrid');
// print with customized rows
$('#dg').datagrid('print', {
title: 'DataGrid',
caption: 'Caption',
fields: ['itemid','productid'],
rows: rows,
footer: [{
productid: 'Summary',
listprice: 30
},{
productid: 'Summary',
listprice: 40
}]
});
|
