This is a migrated thread and some comments may be shown as answers.

Multi filter - use client template data

1 Answer 404 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 26 Jul 2017, 09:35 PM

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. 

 

 

1 Answer, 1 is accepted

Sort by
0
Preslav
Telerik team
answered on 28 Jul 2017, 08:42 AM
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.
Tags
Grid
Asked by
Marc
Top achievements
Rank 1
Answers by
Preslav
Telerik team
Share this question
or