EasyUI Forum
March 28, 2024, 11:47:39 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Export datagrid Extension to include footer summary and Table caption  (Read 20172 times)
Alfred
Full Member
***
Posts: 134


-Licensed User-


View Profile
« on: November 19, 2019, 10:01:18 AM »

The export datagrid feature is very nice. However, It does not include the footer summary in the result. How do I include the footer summary in the exported table? Is it possible to include our own table caption in the exported version? Normally I used MPDF and phpspreadsheet but when it comes to directly printing html I prefer datagrid export extension. Please can you add the following features:

  • Include footer summary in the exported table
  • Include option for passing table caption in the exported table

Reference: https://www.jeasyui.com/extension/datagrid_export.php

Regards,
Alfred
Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #1 on: November 20, 2019, 12:26:30 AM »

The 'footer' and 'caption' properties are available. Please download 'datagrid-export.js file from https://www.jeasyui.com/extension/datagrid_export.php
Code:
$('#dg').datagrid('toExcel', {
    filename: 'datagrid.xls',
    worksheet: 'Worksheet',
    caption: 'Caption',
    rows: rows,
    footer: [{
        productid: 'Summary',
        listprice: 30
    },{
        productid: 'Summary',
        listprice: 40
    }]
});
Logged
Alfred
Full Member
***
Posts: 134


-Licensed User-


View Profile
« Reply #2 on: November 20, 2019, 11:16:39 AM »

The caption and the footer work. but how do I style the caption? In addition the alignment does not work. Amount here is aligned right, but in the printed output it is aligned left.

Code:
<table id="dg" class="easyui-datagrid" url="data.php" showFooter="true">
   <thead>
        <tr>
            <th field="note" halign="center" width="20" sortable="true" align="left">Item</th>
            <th field="amount" halign="center" width="20" sortable="true" align="right">Amount</th>
   </thead>
</table>
function printList(){
   $('#dg').datagrid('print', {
        title:"List of Data",
        caption: 'List of Data',
        footer: $('#dg').datagrid('getFooterRows')
    });
}


Regards.
Alfred
« Last Edit: November 20, 2019, 11:27:53 AM by Alfred » Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #3 on: November 20, 2019, 07:26:16 PM »

The alignment issue has been fixed. Please update the 'datagrid-export.js' file.
Code:
$('#dg').datagrid('print', {
    title:"List of Data",
    caption: '<div style="padding:10px;">List of Data</div>'
});
Logged
Alfred
Full Member
***
Posts: 134


-Licensed User-


View Profile
« Reply #4 on: November 21, 2019, 07:54:31 AM »

Thanks for the reply. Now all the exported columns are center aligned. I have tested with the following codes:

Code:
<th field="id" halign="center" width="20" sortable="true" align="left">Id</th>
<th field="note" halign="center" width="20" sortable="true" align="left">Note</th>
<th field="entrydate" halign="center" width="20" sortable="true" align="center">Note</th>

I all the column names to be centered, so I used
Code:
halign="center"
however in the printed html all columns are aligned center regardless of the
Code:
align="left"
being used. I hope you can fix the issue.

Thanks and regard,

Alfred

Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #5 on: November 21, 2019, 07:18:16 PM »

The issue has been fixed. Please re-download it again.
Logged
Alfred
Full Member
***
Posts: 134


-Licensed User-


View Profile
« Reply #6 on: November 22, 2019, 10:23:27 AM »

Thanks a million Jarry. it is fixed.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!