Excel export shows empty column for fields that have array of simple strings as values

4 posts, 1 answers
  1. Noah
    Noah avatar
    24 posts
    Member since:
    Jan 2013

    Posted 25 Mar 2016 Link to this post

    columns: [
      {field: 'EmptyExport', values: ['red', 'white', 'blue']},
      {field: 'GoodExport', values: [
        {text: 'red', value: 'red'},
        {text: 'white', value: 'white'},
        {text: 'blue', value: 'blue'}]
      }
    ]

    If you use the excel export feature for a grid with the columns listed above, the 'EmptyExport' field values don't make it into the excel grid (it's just an empty column), but the GoodExport field values do.

    This is with version 2016.1.322

  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2310 posts

    Posted 28 Mar 2016 Link to this post

    Hello Noah,

    I am unable to reproduce the behavior on my end. Here is a small example that demonstrates the feature in action. There is no CDN for version 2016.1.322, but the behavior is the same there too.

    Regards,
    Dimiter Madjarov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Noah
    Noah avatar
    24 posts
    Member since:
    Jan 2013

    Posted 28 Mar 2016 in reply to Dimiter Madjarov Link to this post

    Exports Blank column

    I don't know if that link will work, but if not, if you replace the grid definition in your dojo with the below, you will see the blank column when you export.

    $("#grid").kendoGrid({
      toolbar: ["excel"],
      excel: {
        allPages: true
      },
      columns: [
        { field: "productName" },
        { field: "category", values: [
          "Beverages",
          "Food"
        ] }
      ],
      dataSource: [
        { productName: "Tea", category: "Beverages" },
        { productName: "Ham", category: "Food" }
      ]
    });

  4. Answer
    Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2310 posts

    Posted 28 Mar 2016 Link to this post

    Hello Noah,

    The current implementation is incorrect. As stated in the documentation each item in the columns.values array must have a text and value field. An array of strings is not supported in this case.

    Regards,
    Dimiter Madjarov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top