visible columns json

2 posts, 0 answers
  1. Pankaj
    Pankaj avatar
    10 posts
    Member since:
    Feb 2016

    Posted 19 Oct Link to this post

    Hi,

    I have a requirement where i want only visible columns json data send to server. This is so because user will have ability to hide columns client side. Requirement is create excel at server side with only visible columns.

    Regards,

    Pankaj

  2. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 20 Oct Link to this post

    Hello Pankaj,

    If you are using the client side export, it will work out of the box as shown here:
    http://demos.telerik.com/kendo-ui/grid/excel-export

    If you are using this method for server side export:
    https://github.com/telerik/kendo-examples-asp-net-mvc/blob/master/grid-export-to-excel/KendoGridExportExcelMvc/Scripts/kendoExcelGrid.js#L42-L45
    You may just loop the columns and serialize only the visible one. See the highlighted part of the code in the link above.
    var visibleColumns = [];
    jQuery.each(columns, function (index) {
      if(!this.hidden) {
        visibleColumns.push(this);
      }
    });

    It is pretty much the same for the dpl example:
    https://github.com/telerik/ui-for-aspnet-mvc-examples/blob/master/grid/grid-dpl-integration/GridExcelSpreadProcessing/Views/Home/Index.cshtml#L40-L45

    Regards,
    Vasil
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top