Show/Hide Columns Dynamically

4 posts, 0 answers
  1. Paul
    Paul avatar
    56 posts
    Member since:
    Jan 2006

    Posted 06 Apr 2015 Link to this post

    I have been unable to show/hide columns dynamically within a treelist. I have an outside button that I want to swap between hidden and shown columns. I have read the documentation and tried to use:

         var treelist = $("#treeList").data("kendoTreeList");
        treelist.hideColumn(1);  

     However, this does not seem to work. Any help would be appreciated.

  2. Paul
    Paul avatar
    56 posts
    Member since:
    Jan 2006

    Posted 06 Apr 2015 Link to this post

    Also, I am already using:

    Kendo UI v2015.1.403

  3. Kendo UI is VS 2017 Ready
  4. Paul
    Paul avatar
    56 posts
    Member since:
    Jan 2006

    Posted 07 Apr 2015 in reply to Paul Link to this post

    The issue stems from when you apply a headerAttribute or attribute style within the columns definition. When this is removed, the show/hide functionality works as expected. 

             var regionHeaderStyle = {
                "class": "name-header-region",
                style: "text-align:right; font-weight:bold;"
            };

            var regionCellStyle = {
                "class": "name-region",
                style: "width:font-size:10px"
            }


            var centerStyle = {
                "class": "name-header-center",
                style: "text-align:center; font-weight:bold;"
            };

            var cellStyle = {
                "class": "name-cell",
                style: "text-align: right; font-size:11px;"
            }

     $("#treelist").kendoTreeList({
                dataSource: dataSource,
                selectable: true,     
                columns: [{
                    field: "GeogDesc",
                    title: "Region",
                    headerAttributes: regionHeaderStyle,
                    attributes: regionCellStyle
                }, {
                    field: "DispPYTD",
                    title: "Disp PYTD",
                    headerAttributes: centerStyle,
                    attributes: cellStyle
                }]
            });



  5. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 08 Apr 2015 Link to this post

    Hello Paul,

     

    It looks like an issue that we need to investigate further. I have logged it in our internal bug tracker and as soon as more information is available I will make sure to get back to you.

     

    Thanks for the understanding.

     

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready