This is a migrated thread and some comments may be shown as answers.

Export via TagHelpers

7 Answers 295 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 11 Sep 2018, 03:14 AM

     Didn't see this anywhere in the documentation. How exactly would I set up the toolbar with an Excel export options. I know with HtmlHelpers I would do

.ToolBar(tools => tools.Excel())

But i'm not seeing any way to do that with the TagHelpers <excel /> and <toolbar></toolbar>.

Thanks in advance.

7 Answers, 1 is accepted

Sort by
0
Preslav
Telerik team
answered on 13 Sep 2018, 01:29 PM
Hello Richard,

Based on the syntax from the below article:
I added this code:

<toolbar>
    <toolbar-button name="excel"></toolbar-button>
</toolbar>

To the "Grid / Tag Helper" demo:
Now, the Grid is exported to Excel as expected.

Please, give this a try, and let me know if the above works for you.


Regards,
Preslav
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Richard
Top achievements
Rank 1
answered on 20 Sep 2018, 02:25 AM

Preslav,

Thanks, that works great. It's a bit obscure though, but makes sense in a way. Is there a list somewhere of all built-in grid toolbar functionality that can be added based on naming a toolbar-button properly?

0
Preslav
Telerik team
answered on 20 Sep 2018, 07:32 AM
Hi Richard,

For the time being, the list is available only in the Kendo UI for jQuery docs:
I understand that the list should be also placed in the ASP.NET Core documentation. I can confirm that we are doing our best to improve the Core docs as fast as we can.


Regards,
Preslav
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Daniel
Top achievements
Rank 1
answered on 09 Jul 2020, 02:34 AM

So I am trying to use the attached photo demonstrates. I can confirm that when the export button is clicked the grid sends a read request to the server but it doesn't do anymore than that. I have also tried with the "export to pdf" button which does indeed work. So it must be something to do with the excel itself. 

 

 

0
Daniel
Top achievements
Rank 1
answered on 09 Jul 2020, 02:35 AM

I couldn't get the code to format correctly so I am attaching a photo to help with readability and i'll paste the code if you want to copy it.

 

<kendo-grid name="grid"
            on-data-bound="updateResultCount"
            height="800" style="cursor:pointer"
            resizable="true" reorderable="true"
            detail-template-id="gridRowTemplate"
            auto-bind="true" selectable="single"
            on-change="gridRowChanged">

    <datasource type="DataSourceTagHelperType.Ajax" page-size="pageSize" server-paging="true">
        <transport>
            <read url="@Model.ReadUrl" data="@Model.AdditionalDataFunction" datatype="json" />
        </transport>

    </datasource>
    <toolbar>
        <toolbar-button name="excel"></toolbar-button>
    </toolbar>
    <columns>
        @foreach (var col in Model.Columns)
        {
            <column field="@col.FieldName" title="@col.Title" width="250" min-resizable-width="50"></column>
        }

    </columns>
    <pageable enabled="true" page-size="pageSize" button-count="1"></pageable>
    <scrollable enabled="true" />
    <sortable enabled="true" />


</kendo-grid>

0
Preslav
Telerik team
answered on 13 Jul 2020, 03:33 PM

Hi Daniel,

Based on the provided information, I assume that the JSZip library is not included in the app. More information about this is available here - https://docs.telerik.com/aspnet-core/compatibility/export-support#jszip-library

Could you check if it is included, and if it is not, add it to the solution?

 

Regards,
Preslav
Progress Telerik

0
Daniel
Top achievements
Rank 1
answered on 20 Jul 2020, 02:02 PM
Ah, that was probably my issue. I downloaded a custom telerik package from 
https://www.telerik.com/download/custom-download and had checked "Export to Excel" support so I assumed it had added all the necessary references, thanks.
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Preslav
Telerik team
Richard
Top achievements
Rank 1
Daniel
Top achievements
Rank 1
Share this question
or