We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Filtering template image columns

Hi,

I have a column where a template like this is applied:

            <script type="text/x-jsrender" id="statusTemplatePLP">
                <img src="/Content/Images/status/{{*: data.status}}.png" alt="{{*: data.status}}" title="{{*: data.status}}" />
            </script>

That status can be something like "In Review".

I am using the filtering bar to filter records and on this field, I cannot use it as it does not filter. If I try to type "In" it yields no results as the image is there instead of the text. I have also tried adding a <a>In review</a> in front of the image and still it does not work.

Is there a way to apply a custom filter for a specific field?

Thank you for your support!

Kind regards,
Carlos

3 Replies

RU Ragavee U S Syncfusion Team October 14, 2016 08:49 AM UTC

Hi Carlos, 

Generally, the filtering action is performed based on the field property of the column. However if you want to apply custom filter on a column, then we suggest you to use the filterBarTemplate feature of the grid. Please refer to the below online sample link for more information on this feature. 


Please refer to the below demo link in which we have achieved your requirement to apply custom filter for a column. 


In the above sample, we have bound “Title” field for the template column and have displayed images based on the “EmployeeID” column. Using the filterBarTemplate feature, we have created an input element using create event And have bound the read function in the focusout event of the input element. 

As you can see, in the read function, we have invoked the filterColumn method of the grid passing the field, value and operator for performing filtering operation on that specific field. 

Regards, 
Ragavee U S. 



CR Carlos Rodríguez García October 14, 2016 10:25 AM UTC

Hi,

Thank you very much for the information, this has solved my issue and given me some great ideas!

Again, thank you for your support!

Kind regards,
Carlos


RU Ragavee U S Syncfusion Team October 17, 2016 05:40 AM UTC

Hi Carlos, 
  
Thanks for your update. 
 
We are happy that your requirement is achieved. 
  
Regards, 
Ragavee U S. 


Loader.
Live Chat Icon For mobile
Up arrow icon