igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

Search not working properly in grid with custom cell using ngFor

Open lalo-mx opened this issue 8 years ago • 3 comments

Description

Search not working properly in grid with custom cell using ngFor

  • igniteui-angular version: 6.1.3
  • browser: Chrome 68.0.3440.106

Steps to reproduce

  1. Open example: Sample
  2. Search "consumer" in main input of search

Result

In column IndustrySector in the first row the value of the cell is "--Consumer--Consumer"

Expected result

In column IndustrySector in the first row the value of the cell should be "Consumer"

Reference: #1931

Attachments

image igx-grid-with-searching-2-redtvp.zip

lalo-mx avatar Aug 16 '18 22:08 lalo-mx

@lalo-mx My comment from the issue you have referenced explains exactly what is going on here, as well. The search currently has a limitation and it doesn't work properly with templates. Do you really need the this template? Virtually identical functionality can be achieved with simply using a column formatter and then the search will work well. If you need help to do this, please see this stackblitz sample.

DDavidkov avatar Aug 17 '18 13:08 DDavidkov

@DDavidkov The problem I am trying to solve is when a column has a numerical value that is represented by a label, for example (The active state has value "1" and the label "Active", the value "0" and the label "Inactive"). This problem can be solved with a select but the grid does not support this type of columns. My idea to solve this problem was to have a template and filter the collection of states and only show the one that corresponds to the value of the cell.

I will test the column formatter option that you are suggesting.

lalo-mx avatar Aug 17 '18 13:08 lalo-mx

@lalo-mx If I am understanding your use case correctly and you just want to have labels representing numbers in your data, you can definitely implement this by just using a column formatter. To do that add a switch case in your formatter that would switch on the numeric value and return the appropriate string for that number.

DDavidkov avatar Aug 17 '18 14:08 DDavidkov