infor-design / enterprise

Enterprise-grade component library for the Infor Design System
https://design.infor.com
Apache License 2.0
134 stars 81 forks source link

Excel export: The excel exported from DataGrid with group have no data. #4081

Closed Roking closed 4 years ago

Roking commented 4 years ago

Describe the bug We have upgraded ids-enterprise to 4.28.0 and tried to export excel from datagrid with group, but the generated excel had no data, just a header. But if no group, the excel will have data. Both are normal with data when using infor/sohoxi 4.5.0

To Reproduce Steps to reproduce the behavior:

  1. Access the example: https://usspvwhvgmdemo:20493/ids-enterprise-ng-demo/
  2. Click on "D→DataGrid - Groups" on the left menu, and the page shows a table with group and data.
  3. Click on the link "Export to Excel".
  4. Open the exported excel, you can see it only includes group info and other data is missing. Please refer to the screenshots.

Expected behavior The exported excel should include all data in the DataGrid.

Version

Screenshots The DataGrid page: image

The exported excel: image

Platform All

Additional context DataGrid-groupable demo code: datagrid-groupable.demo.zip

tmcconechy commented 4 years ago

I've attached a more simple EP example that replicates the issue i will also push this. app/views/components/datagrid/test-grouping-export.html it looks like its only exporting the headers.


<div class="row bottom-padding">
  <div class="twelve columns">
    <div class="toolbar" role="toolbar">
      <div class="title">
        Compressors
        <span class="datagrid-result-count">(10 Results)</span>
      </div>
      <div class="buttonset">
        <button type="button" class="btn" id="export-to-csv">
          <svg class="icon" focusable="false" aria-hidden="true" role="presentation">
            <use href="#icon-export-spreadsheet"></use>
          </svg>
          <span>Export To Csv</span>
        </button>
        <button type="button" class="btn" id="export-to-excel">
          <svg class="icon" focusable="false" aria-hidden="true" role="presentation">
            <use href="#icon-export-spreadsheet"></use>
          </svg>
          <span>Export To Excel</span>
        </button>
      </div>

      <div class="more">
        <button type="button" class="btn-actions">
          <svg class="icon" focusable="false" aria-hidden="true" role="presentation">
            <use href="#icon-more"></use>
          </svg>
          <span class="audible">More Actions</span>
        </button>
        <ul class="popupmenu">
          <li><a data-option="personalize-columns" href="#">Personalize Columns</a></li>
          <li><a data-option="reset-layout" href="#">Reset to Default</a></li>
          <li class="separator"></li>
          <li class="heading">Row Height</li>
          <li class="is-selectable"><a data-option="row-short" href="#">Short</a></li>
          <li class="is-selectable"><a data-option="row-medium" href="#">Medium</a></li>
          <li class="is-selectable is-checked"><a data-option="row-normal" href="#">Normal</a></li>
        </ul>
      </div>
    </div>
    <div id="datagrid">
    </div>
  </div>
</div>

<script>
  $('body').one('initialized', function () {
    var grid,
      columns = [],
      data = [];

    //Define Columns for the Grid.
    columns.push({ id: 'drilldown', name: '', field: '', resizable: false, formatter: Formatters.Drilldown, click: function(e, args) {
      console.log('Drilldown ', args[0]);
    }, align: 'center', sortable: false});
    columns.push({ id: 'id', name: 'Customer Id', field: 'id'});
    columns.push({ id: 'type', name: 'Type', field: 'type'});
    columns.push({ id: 'location', name: 'Location', field: 'location', formatter: Formatters.Hyperlink});
    columns.push({ id: 'firstname', name: 'First Name', field: 'firstname'});
    columns.push({ id: 'lastname', name: 'Last Name', field: 'lastname'});
    columns.push({ id: 'phone', name: 'Phone', field: 'phone'});
    columns.push({ id: 'purchases', name: 'Purchases', field: 'purchases'});

    //Get some data via ajax
    var url = '{{basepath}}api/accounts';

    $.getJSON(url, function(res) {
      grid = $('#datagrid').datagrid({
        columns: columns,
        dataset: res,
        groupable: {
          fields: ['type'],
          expanded: true
        },
        toolbar: {title: 'Accounts', results: true, personalize: true, actions: true, rowHeight: true, keywordFilter: false}
      });
    });
    $('#export-to-csv').on('click', function () {
      grid.data('datagrid').exportToCsv('myExport');
    });
    $('#export-to-excel').on('click', function () {
      grid.data('datagrid').exportToExcel('myExport');
    });
  });
</script>
janahintal commented 4 years ago

QA Passed. Thank you. :) Verified in https://master-enterprise.demo.design.infor.com/components/datagrid/test-grouping-export.html image

GauravJags commented 4 years ago

Hi,

My project is created using Odin CLI version 2.2.1. Also i am using sohodatagrid. I am not sure about the steps that needs to be performed so that i can use the latest changes done in the above fix.

Thanks,

Regards,

tmcconechy commented 4 years ago

You might have to ask the Odin developers. We don't maintain that repo. Does it have a git or oxford repo?

My guess which would be normal is update ids-enterprise in the package.json to the latest version