EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: juancitop on March 05, 2020, 07:08:25 AM



Title: PivoteGrid - Export data
Post by: juancitop on March 05, 2020, 07:08:25 AM
Is posible export to excel ?

Thanks in advance.


Title: Re: PivoteGrid - Export data
Post by: jega on February 04, 2021, 04:04:38 AM
Is there any help for this ??

I need it too ;-)

Regards
Jesper


Title: Re: PivoteGrid - Export data
Post by: jarry on February 05, 2021, 01:40:06 AM
The 'toExcel' method is available. Please download a newer version from https://www.jeasyui.com/extension/pivotgrid.php


Title: Re: PivoteGrid - Export data
Post by: jega on February 05, 2021, 03:08:47 AM
Hi Jarry.

Thanks.

But there is an error. Excel sheet contains double rows

See attachment.

And how to only have selected rows to excel ?


Title: Re: PivoteGrid - Export data
Post by: jarry on February 09, 2021, 06:50:22 PM
Please download a newer version from https://www.jeasyui.com/extension/pivotgrid.php
To export the selected rows, please try this code.
Code:
var rows = $('#pg').pivotgrid('getSelections')
$('#pg').pivotgrid('toExcel', {
  filename: 'test.xls',
  rows: rows
})


Title: Re: PivoteGrid - Export data
Post by: jega on February 10, 2021, 02:52:20 AM
Hi Jarry

Using the latest version 1.0.2. Checked that it not is using file from cache.

Same error. exports double rows

Selected rows also exports all rows, and double.


Title: Re: PivoteGrid - Export data
Post by: jarry on February 10, 2021, 08:17:52 AM
Please make sure the 'rows' passed to the 'toExcel' method is not empty.
Code:
$('#pg').pivotgrid('toExcel', {
  filename: 'test.xls',
  rows: rows
})


Title: Re: PivoteGrid - Export data
Post by: juancitop on February 10, 2021, 10:27:59 AM
Hi Jarry, thanks for adding export method.
I'm having the same problem, the duplicated values when export, but the same occurs at Totals...

I´m exporting all rows:

Code:
$('#pg').pivotgrid('toExcel', {
filename: 'pivotgrid.xls',
worksheet: 'Worksheet',
caption: 'Caption'
});


Title: Re: PivoteGrid - Export data
Post by: jarry on February 11, 2021, 05:53:03 PM
This issue has been fixed. Please download a newer version from https://www.jeasyui.com/extension/pivotgrid.php


Title: Re: PivoteGrid - Export data
Post by: juancitop on February 12, 2021, 07:50:28 AM
Thanks jarry !!!

There is a problem that persist, please see attached img.



Title: Re: PivoteGrid - Export data
Post by: jega on February 14, 2021, 02:33:51 AM
Hi Jarry.

Now it works. No double rows

Using this var rows = $('#pg').pivotgrid('getSelections') always take all rows

Changed it to getCheckedNodes and it exports only selected rows. If no rows selected it export all

Maybe you can answer this. Filename = pg.xls

When open exported file in excel, it says

"the file format and file extension of pg.xls do not match. File can be corrupted or......."

I can just push the YES button to open it, and everything is fine


Jesper