2
votes

which shows a table with its column. What I need is building a search lookup function instead of the default filter function, so that ON The List of Values in Mini Filter window and NOT the whole table: [![enter image description here][1]][1]

If typing the full name Michael then the table will be filtered by Michael, OR if I type the phone number then the name of Michael will be filtered by Michael. in other words.

I dont what to change the values of the filter to filter based tokens, and i also dont want to change the columns values to column based token, but i only need that if the input of the user in the search field is inside the tokens then returns the key of the token and show it to the user.

2
No, i need the search function of mini filter window and not that wohle table.Alex

2 Answers

1
votes

Got a working example here. Note that I'm not very familiar with Angular, so the code might seem weird.

I defined a custom filter, called CustomSetFilter, in which the text input functions as a search field for the tokens of each checkbox as defined in filterData. If the input is empty, all checkboxes appear. If not, only checkboxes that have a token equal to the input's value (ignoring case) will show up. This can be seen in the onChange() function.

-2
votes

I don't know if AgSetFilter is required, but we can do it with TextFilter

1)First of all, we should create a column based on tokens

2)then we need to format the value for the good name in cell because we had a array

3)and write a custom filter options

this.columnDefs = [
  {
    field: 'tokens',
    filter: 'agTextColumnFilter',
    valueFormatter: p => p.value[0],
    filterParams: {
      filterOptions: [{
      displayKey: 'ByToken',
      displayName: 'ByToken',
      test: function (filterValue, cellValue) {
        const array = cellValue.split(',')
        return array.includes(filterValue);
      },
      hideFilterInput: false
      }]
    },
  }
];

result:

enter image description here

enter image description here

WORKING EXAMPLE:

https://plnkr.co/edit/7mtR5Kq3Hyqup0Ta