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?
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
Hi,
Thank you for replying. I was able to solve the problem.
Hi Germie,
Thanks for your update.
Regards,
Sureshkumar P