[Data Grid Web] [Data Grid] Export grid data doesn't work for Auto calculated columns
Question
Forge component by OutSystems R&D

Hi,

I am using data grid web component in my application in which I have few auto calculated columns based on other column data. I have added the handler for formatitem in JavaScript to calculate the data - 

 grid.formatItem.addHandler(function (s, e) {
        //
        // cells and column footer panels only
        if (e.panel == s.cells) {
            //
            // get row, column, and data item (or group description)
            var r = s.rows[e.row];
            var c = s.columns[e.col];
            var item = s.rows[e.row].dataItem;
            var group = r instanceof wijmo.grid.GroupRow ? item : null;
      
            // assume value is not negative
            var negative = false;
            //
            // calculate Outstanding
            if (c.binding == 'Outstanding') {
               var outstandingGroup = group ? group.getAggregate('Sum', 'Incurred') - group.getAggregate('Sum', 'Paid')
                    : item.Incurred - item.Paid;
                var outstandingGroup = isNaN(outstandingGroup)?0:outstandingGroup;
                e.cell.textContent = wijmo.Globalize.format(outstandingGroup, c.format);
               
            
                }
                negative = outstandingGroup < 0;
            }  
            });

But after adding this,the export action of the grid doesn't export the data of auto calculated column (Outstanding column).

Please suggest how can we get that data into exported excel sheet.


Thanks,

Unnati 

Hi Unnati,


Can you please send us a sample with your custom code, so we can investigate?


Thank you,

Gabriel Lundgren

Hi Gabriel,

I have attached the .oap file for sample.

In this the "Column3" is auto calculated column i.e. addition of "Column1" and "Column2". I have added the script on the Page JavaScript property and in preparation I have used the run JavaScript action to execute those java scripts.

Also the Columns are editable so that you can add data and check.

Below is the URL through which you can access the sample application - 

https://unnati-khanorkar.outsystemscloud.com/DataGridIssue/Entry1.aspx

The  export button will export the data from other columns but the "Column3" data was not exported.

Let me know if you need anything else.


DataGridIssue.oap


Hi Unnati,


Thank you for sending the sample. 

Since you are extending OS Grid capabilities,  we can't really help you. Our investigation showed that this is not available in the wijmo Grid. You can find further information on wijmo's forum or their documentation.


Thank you,

Gabriel Lundgren


Hi Gabriel,

Thank you for your reply. I will go through the wijmo forum and documentation again.
Other than that if you could suggest any solution to get the requirement fulfilled that will be helpful.

Thanks,

Unnati.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.