New to Kendo UI for jQueryStart a free 30-day trial

Customize the Pdf Export Filename of the Grid by Adding Current Date and Time

Environment

ProductProgress® Kendo UI® Grid for jQuery

Description

How can I add the current date and time to the Pdf export filename of the Grid?

Solution

  1. Use the pdfExport event to access the Grid options.

  2. With the help of the kendo.toString() method or another way to format the date, concatenate the date to the filename:

js
    pdfExport: function(e) {
      e.sender.options.pdf.fileName = kendo.toString(new Date, "dd/MM/yyyy HH:mm") + " Grid.pdf";
    }
    <div id="grid"></div>
    <script>
    $("#grid").kendoGrid({
      toolbar: ["pdf"],
      columns: [
        { field: "name" }
      ],
      pdfExport: function(e) {
        e.sender.options.pdf.fileName = kendo.toString(new Date, "dd/MM/yyyy HH:mm") + " Grid.pdf";
      },
      dataSource: [
        { name: "Jane Doe"},
        { name: "John Doe"}
      ]
    });
    var grid = $("#grid").data("kendoGrid");
    </script>
In this article
EnvironmentDescriptionSolution
Not finding the help you need?
Contact Support