Search icon in FilterBar

Is it possible to add an icon in the right side of the input of filter bar where it will be replaced by the "X" mark once user typed in it?



3 Replies 1 reply marked as answer

SP Sureshkumar P Syncfusion Team September 30, 2022 08:58 AM UTC

Hi Germie,

We suggest you use the below code example to replace the search icon in the search textbox to the dropdownlist component.

Find the code example here:

<template>

<div class="control_wrapper">

   <ejs-dropdownlist id='dropdownlist' :allowFiltering='true' :dataSource='sportsData' :open='componentCreated'></ejs-dropdownlist>

</div>

</template>

<script>

import { DropDownListComponent } from "@syncfusion/ej2-vue-dropdowns";

 

//Component registeration

export default {

name: 'App',

components: {

    'ejs-dropdownlist' : DropDownListComponent,

},

data () {

        return {

            sportsData: ['Badminton', 'Cricket', 'Football', 'Golf', 'Tennis']

        }

    },

    methods: {

    componentCreated: function () {      

      var dropObj = document.getElementById('dropdownlist').ej2_instances[0];

      var iconElement = dropObj.popupObj.element.querySelector(".e-filter-parent .e-input-group-icon");

      iconElement.classList.remove("e-clear-icon");

      iconElement.classList.add("e-search");

      iconElement.style.visibility = "visible";

      iconElement.addEventListener("click", function(){

        console.log("IConclicked");

      });

    },

  }

}

</script>

<style>

 @import "../node_modules/@syncfusion/ej2-base/styles/material.css";

@import "../node_modules/@syncfusion/ej2-inputs/styles/material.css";

@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";

.control_wrapper {

    max-width: 250px;

    margin: 0 auto;

}

.e-search:before{

    content:'\e993';

}

</style>

 


Find the sample in the attachment:

Note: If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.

Regards,

Sureshkumar P


Attachment: DDL_55d2a13d.zip

Marked as answer

GF Germie Fernandez September 30, 2022 05:46 PM UTC

Hi,

Thank you for replying. I was able to solve the problem.



SP Sureshkumar P Syncfusion Team October 3, 2022 07:33 AM UTC

Hi Germie,

Thanks for your update.


Regards,

Sureshkumar P


Loader.
Up arrow icon