Multi filter - use client template data

2 posts, 0 answers
  1. Marc
    Marc avatar
    128 posts
    Member since:
    Jul 2010

    Posted 26 Jul 2017 Link to this post

    If we have a client template on a column, is there an easy way to have the multi filter use that value?

     

    columns.Bound(c => c.Logon).Filterable(f => f.Multi(true)).ClientTemplate("#= FullName #")

     

    We want FullName in the filter dropdown. 

     

     

  2. Preslav
    Admin
    Preslav avatar
    591 posts

    Posted 28 Jul 2017 Link to this post

    Hello Marc,

    The Grid does not provide this functionality out of the box.

    A possible solution for achieving the desired behavior is handling the filterMenuInit event. In the event handler function, get the list of node values and update the text using the same logic as the client template.
    For example, the code might look like:

    filterMenuInit: function(e){
      e.container.children().first().children().each(function(e){
        var label = $(this).find("label");
        var text = label[0].lastChild.nodeValue;
         
        label[0].lastChild.nodeValue = changeLabelText(text);
      });
    },
     
     
    //...
     
    function changeLabelText(text){
      if(text==="Select All") return text;
     
      return text + " +templateText";
    }

    For a runnable example, check this Dojo: http://dojo.telerik.com/exubA

    I hope the above helps.


    Regards,
    Preslav
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top