[Data Grid] Exporting links

Forge Component
(26)
Published on 31 Jul by OutSystems R&D
26 votes
Published on 31 Jul by OutSystems R&D

Hey guys,

When using the export function it seems to be exporting my URL, instead of the title which is being displayed (I'm using title to display a nice dynamic textual value instead of the url).

Any idea's in how I can achieve getting the display value only instead of the full url when using an export?

I got this working myself, but I had to create a clone of the component in order to add a bit of code in the export excel function.

Using the formatitem event on the xlsx save class.

Solution

I have updated the exportExcelFromContextMenu function to:

exportExcelFromContextMenu: function(gridId) {
        // create book with current view
        var flexGrid = GridOS.ComponentUtils.getGridObjectById(gridId).grid;
        var book = wijmo.grid.xlsx.FlexGridXlsxConverter.save(flexGrid, {
            includeColumnHeaders: true,
            formatItem: function(args) {
                var cellVal = args.xlsxCell;
                if($(args.cell).children('a').length){
                    cellVal.value = $(args.cell).children('a').first().text();
                }
            }
        });
        book.sheets[0].name = 'export';
        // save the book
        book.save("export.xlsx");
    }

This will allow links to be exported using the display value (you can set title to be used as a display value).

I have not done the csv version yet... there's not a formatItem function I could use there I'm afraid.

Perhaps Outsystems R&D can include this in the original component?

Solution

Hey Joey!


We'll definitely have a look at this and implement it.

Thank you so much for all the help with this and all of your answers and solutions on the other threads :) 


Cheers!