Home Analyst Portal

Export to Excel for Related Items of Problem Records

Jonathan_BolesJonathan_Boles Customer Ninja IT Monkey ✭✭✭✭
Greetings Cireson Community!

I've been trying to work through a customization and have gotten to the point where I'm not making any forward progress. I'm trying to add 'Export to Excel' functionality to the work items table shown on the Related Items tab of a PR work item. 

I successfully used the customization provided by @Roland_Kind on other pages but this one simply has me stumped. I'm able to successfully add the button just fine but can't seem to get the data to create the .XLSX download as expected. Any help or suggestions anyone can provided would be most appreciated!!!


Best Answer

  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    Answer ✓
    The good news is that it is a Kendo Grid widget, and this is a built-in function of them.

    Your button simply needs to call that function.  Here is an example:

    var grid = $('div#RelatesToWorkItem div[data-role="grid"]').getKendoGrid();
    grid.saveAsExcel();
    That's it! 

    There is more that you can do (either prior to the above button click, or as part of it) if you want to affect the filename, of course.  For example:

    grid.options.excel = { fileName: pageForm.viewModel.Id + ".xlsx", allPages: true, proxyURL: "" };

    Extra credit:
    Note that you can also export to PDF, if that is useful to you, but that this function depends on certain Kendo files such as the DejaVuSans.ttf font and possibly other things that you would have to straighten out before it would work properly.

    grid.options.pdf = { filename: pageForm.viewModel.Id + ".pdf", allPages: true, proxyURL: "" };
    grid.saveAsPDF();

Answers

  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    Answer ✓
    The good news is that it is a Kendo Grid widget, and this is a built-in function of them.

    Your button simply needs to call that function.  Here is an example:

    var grid = $('div#RelatesToWorkItem div[data-role="grid"]').getKendoGrid();
    grid.saveAsExcel();
    That's it! 

    There is more that you can do (either prior to the above button click, or as part of it) if you want to affect the filename, of course.  For example:

    grid.options.excel = { fileName: pageForm.viewModel.Id + ".xlsx", allPages: true, proxyURL: "" };

    Extra credit:
    Note that you can also export to PDF, if that is useful to you, but that this function depends on certain Kendo files such as the DejaVuSans.ttf font and possibly other things that you would have to straighten out before it would work properly.

    grid.options.pdf = { filename: pageForm.viewModel.Id + ".pdf", allPages: true, proxyURL: "" };
    grid.saveAsPDF();

  • Jonathan_BolesJonathan_Boles Customer Ninja IT Monkey ✭✭✭✭
    @Tom_Hendricks, this was TREMENDOUSLY helpful! I got close but was missing a few details in the above that made all the difference. Really appreciate the quick response and assistance!
Sign In or Register to comment.