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

Custom cell not rendering with grid searching functionality

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

Description

Describe the issue.

Steps to reproduce

  1. Open example Grid Searching example
  2. Search "Airlines" in main input of search

Result

The default value is rendered. In first cell the value "Consumer" is shown.

Expected result

The custom value "Consumer-1" should be shown in the first cell

lalo-mx avatar Jul 04 '18 20:07 lalo-mx

@lalo-mx There is a limitation of the search that it cannot search through content generated dynamically through template. This is because most of the grid's cell are virtualized (i.e. they are not part of the DOM, unless they are scrolled into view), so we have no way of knowing, prior to actually rendering a cell, what its contents will be. Since the search needs to know this beforehand, we can't properly search templated cells.

Still, there is a fairly simple workaround. You can simply define a formatter on the column level, that outputs the same values as your template does and it will be properly picked up by the search functionality. I modified your sample to demonstrate how to do this. You can see that it no longer replaces the template. However, there is still another issue in the sample and it you can notice it if you search for "-1" (i.e. a value that is part of the value from the template, but not in the underlying value). The "-1" is highlighted but the active highlight is missing and the grid thinks no values are found. I have just created a PR for this and it will be resolved once the PR gets merged.

DDavidkov avatar Jul 06 '18 13:07 DDavidkov