Author Topic: Export to Excel with Nesting colModel  (Read 1900 times)

TonyLeech

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Export to Excel with Nesting colModel
« on: October 09, 2020, 01:38:20 am »
Part of my grid uses a nested colModel like

Code: [Select]
{ title: "Physical Difference", minWidth: 120, align: "center", colModel: [
{ title: "Quantity", minWidth: 80, align: "center", dataIndx: "diffqty", dataType: "integer", editable: false, hidden: true,
filter: { crules: [{condition: 'between'}]},
},
{ title: "Value £", minWidth: 80, align: "center", dataIndx: "diffval", dataType: "float", editable: false, hidden: false, format: "£#.00",
filter: { crules: [{condition: 'between'}]},
}
]},

When I export the whole grid to Excel the column headers are out of line with the data columns and I find the 'details' icon is exported as the first column like this...

Code: [Select]
<div class='ui-icon ui-icon-triangle-1-e glyphicon glyphicon-plus'></div>
... even though the details column is marked with 'copy: false'

Code: [Select]
{ title: "", minWidth: 27, maxWidth: 27, type: "detail", resizable: false, copy: false, editable: false, menuIcon: false, menuInHide: true },

Is this a bug?  Is there a workaround?  Have I missed something in the colModel api?

Many thanks for your assistance.

Regards, Tony

TonyLeech

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Re: Export to Excel with Nesting colModel
« Reply #1 on: October 09, 2020, 06:43:07 pm »
You can verify this for yourself using your "Export nested grids" demo at https://paramquery.com/pro/demos/export_detail

Replace lines 114-115
Code: [Select]
                { title: "Ship Country", width: 100, dataIndx: "ShipCountry" },
                { title: "Shipping City", width: 100, dataIndx: "ShipCity" },

with a nested colModel like this
Code: [Select]
{ title: "Where", minWidth: 120, align: "center", colModel: [
        { title: "Ship Country", width: 100, dataIndx: "ShipCountry" },
            { title: "Shipping City", width: 100, dataIndx: "ShipCity" }
]},

Then your export to Excel will have column headers misaligned with column data and the icon for expanding detail will appear in the Excel column 1 as
Code: [Select]
<div class='ui-icon ui-icon-plus'></div>

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Export to Excel with Nesting colModel
« Reply #2 on: October 09, 2020, 10:22:33 pm »
copy: false can be used in case of non-grouped colModel only.

For grouped columns you can create new colModel without unwanted columns before export and then revert back to original colModel after the export.