search multiple columns

Hi,

I have this employee table, which has first_name,last_name, phone. I would like to use autocomplete component to select when you type phone number or first name or last name.

thanks


1 Reply

UD UdhayaKumar Duraisamy Syncfusion Team July 21, 2022 04:57 PM UTC

Hi Tingting,


We have prepared a sample for the requested requirement using Custom filtering and shared the sample link below. Please refer to the below code snippet and sample for more details.


onFiltering(e) {

    let Fuse = require('fuse.js');

    let options = {

      keys: ['Vegetable''Category''Id'],

      includeMatches: true,

      findAllMatches: true,

    };

    let fuse = new Fuse(this.vegetableDataoptions);

    let result = fuse.search(e.text);

    let data = [];

    for (let i = 0i < result.lengthi++) {

      data.push(result[i].item);

    }

    e.updateData(datanull);

  }

 


Sample : https://stackblitz.com/edit/react-rpmfhr?file=index.js,dataSource.json


Kindly try the above sample and let us know if this meets your requirement.


Regards,

Udhaya Kumar D



Loader.
Up arrow icon