show/hideColumn performance issues

5 posts, 1 answers
  1. Chris
    Chris avatar
    3 posts
    Member since:
    Sep 2016

    Posted 07 Oct Link to this post

    Hi, I have implemented a second custom "column filter" to hide columns that start with a certain string based on user selection - 

    Columns: Aaron, Chris, Ashley, Ryan

    My selector has options 'A', 'C', 'R' with checkboxes, when one is unchecked, it will hide all cols that start with 'A', for example. 

     

    My issue is in the performance of this method when the grid has many (50+) columns, taking multiple seconds to fulfill this loop: 

    var grid = $("grid").data().kendoGrid;

    var columns - grid.columns

    $.each(columns, function(i, el){

         

  2. Chris
    Chris avatar
    3 posts
    Member since:
    Sep 2016

    Posted 07 Oct Link to this post

    apparently can't edit my post... anyway

    $.each(columns, function(i, el){

         var CurrentColumn - columns[i];

         var currentTitle - currentColumn.title; 

         var colTitleText = jQuery(currentTitle).text();

         if(colTitleText.indexOf('A') == 0){

            grid.hideColumn(el)

    }});

      

  3. Kendo UI is VS 2017 Ready
  4. Answer
    Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    347 posts

    Posted 11 Oct Link to this post

    Hello Chris,

    I can recommend setting the columns.hidden option, based on the described custom logic while looping through the columns, and finally use the setOptions() method, passing it the newly obtained columns configuration, e.g.:

    var cols = grid.columns;
    // loop through the columns and set the columns.hidden option
     
    grid.setOptions({
      columns: cols
    });

    This will cause rerendering of the Grid only once, instead of each time the grid.hideColumn() method is called.

    I hope this helps.

    Regards,
    Dimiter Topalov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
  5. Sugendran
    Sugendran avatar
    1 posts
    Member since:
    Dec 2015

    Posted 23 Nov in reply to Dimiter Topalov Link to this post

    This approach works, but we also need to update the column attributes - which is what the "setColumnVisibility" function in the kendo code does.

     

    Would be great if there was a show/hide column method that took an array of columns so that the grid internals could deal with it and repaint only once.

  6. Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    347 posts

    Posted 24 Nov Link to this post

    Hi Sugendran,

    Please submit a feature request to our UserVoice portal:

    http://kendoui-feedback.telerik.com/forums/127393-kendo-ui-feedback

    It is closely monitored, and the most popular ideas are considered for implementation for future Kendo UI releases.

    Our roadmap and priorities depend largely on the business value and customer demand for specific components and features.

    However, I would like to bring your attention to an offering of ours that may be relevant and applicable to your needs - the Feature Acceleration program.

    It allows a customer to negotiate certain functionality to be implemented on demand or sooner than our roadmap implies.

    Let me know if you are interested in pursuing this option and I will put you in touch with our Professional Services team to discuss the exact specification, timeframe and pricing.

    Regards,
    Dimiter Topalov
    Telerik by Progress
    Kendo UI is ready for Visual Studio 2017 RC! Learn more.
Back to Top
Kendo UI is VS 2017 Ready