Disable Aggregates for a single GridNumericColumn

3 posts, 1 answers
  1. Mike
    Mike avatar
    7 posts
    Member since:
    Oct 2014

    Posted 26 Oct Link to this post

    Hi,

    I am using the aggregates context menu to allow the user to choose their own aggregate functions, however, 1 particular column should not allow aggregation as each row is potentially showing a value in a different currency.

    Is there any way that I can disable aggregates for this column only? There doesn't appear to be any column setting relating to this.

    Thanks in advance,
    Mike.

  2. Answer
    Eyup
    Admin
    Eyup avatar
    3014 posts

    Posted 31 Oct Link to this post

    Hello Mike,

    You can use the OnHeaderMenuShowing event handler to achieve this requirement:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/events/onheadermenushowing

    Similar to the javascript approach provided here:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/how-to/Filtering/reduce-the-filter-menu-options

    You can also check the following code-library or the attached web site sample:
    http://www.telerik.com/support/code-library/conditionally-hide-controls-from-excel-like-filtering-menu

    I hope this will prove helpful.

    Regards,
    Eyup
    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 Ajax is Ready for VS 2017
  4. Mike
    Mike avatar
    7 posts
    Member since:
    Oct 2014

    Posted 02 Nov Link to this post

    Thanks for the links Eyup, following the links you provided I simply hooked up the following to the OnHeaderMenuShowing event and it's now working perfectly.

    function ProjectGrid_HeaderMenuShowing(sender, args) {
      var disabledAggregateCols = ["Financial_BudgetCostForeign", "Financial_BudgetSellForeign"];
     
      var colName = args.get_gridColumn().get_uniqueName();
      var filterItem = args.get_menu().findItemByText("Aggregates");
     
      if (disabledAggregateCols.indexOf(colName) >= 0) {
        filterItem.set_enabled(false);
      }
      else {
        filterItem.set_enabled(true);
       }
    }
Back to Top