Resetting cell style when find/replace search string changes

Good day,

When searching a grid via find/replace, is it possible to reset the backcolor from the cells that were highlighted as matches when you change the value that you are searching for.

Example, if I search for the word "test" and all cells that contain that word highlight in Orange, and then I change the search text to "test2", I want only the cells that contain "test2" to be highlighted and all others that were previously orange returned to white.

Thanks.

3 Replies

SN Sindhu Nagarajan Syncfusion Team May 8, 2018 10:13 AM UTC

Hi Travis, 

Thanks for your interest in Syncfusion products. 

By default, in GridControl, when the search text matches with the text in the grid, that text will be highlighted by using GridHighlightSearchText class. If a new text is entered for searching then the color of the text that matches with previous search word is automatically reset. Please refer to the dashboard sample available in your local machine in the below location, 

Sample Location: <Installed Location>\Syncfusion\EssentialStudio\<Installed version>\Windows\Grid.Windows\Samples\Editing\Find-Replace Demo\CS 
Please refer to the video, 
Video Link: Video 

Please let us know if you have any other queries. 

Regards, 
Sindhu  




TC Travis Chambers May 8, 2018 01:25 PM UTC

Ah, thank you! I had already adapted the code from the sample but I managed to forget the ClearHighlight() method. I put that in and now it works find. That being said, that method takes several seconds to complete when you have a few thousand rows. Is there any way to speed up the loop?

Thanks.


SN Sindhu Nagarajan Syncfusion Team May 9, 2018 12:31 PM UTC

Hi Travis, 

Thanks for the update. 

We could able to understand your scenario and analyzed the alternate possible ways to reset the background color for grid cells without looping. We regret to let you know that as per the current support, to reset the backcolor for all cells, looping is the only possible way for this. This is the default behavior of Find and Replace support. 

Please let us know if you have any other queries. 

Regards, 
Sindhu  


Loader.
Up arrow icon