The searchResultsChange event does not fire after search completes

Hi,

The documentation at this page: https://helpej2.syncfusion.com/documentation/document-editor/find-and-replace#searchresultschange-event says that the searchResultsChange event triggers when a find operation completes, when the find result text changes because the found text has been replaced and when the find result is cleared.

In my findings it ONLY triggers when teh find result is cleared and not when a search event is completed.
The following stackblitz example can be used to reproduce this issue:
https://stackblitz.com/edit/i6ebkt-ud87fq?file=index.html,index.ts,default-doc.json

In order to reproduce do the following:
- open the stackblitz example.
- click on the "load" button to put the default example text in the editor control.
- click on the "find" button to search for the first instance of the word "the".. which it does.
- click on the "clear Results" button.. note that it now triggers the "search event!" alert.

I would have expected the "search event!" alert to also be triggered by the "find" button as the code:

container.documentEditor.searchResultsChange = mySearchEvent;

btn.onclick = () => {
  container.documentEditor.search.find('the');
};


function mySearchEvent () {
  alert('search event!')
}

should work if I am reading the documentation correctly, otherwise you might just as well call the event searchResultsClear.
Can this be fixed or is there a workaround for this?

thanks,
Wil


5 Replies

DS Dhanush Sekar Syncfusion Team August 28, 2024 06:40 PM UTC

Hi Will,


We are able to replicate the reported issue and are validating it currently. We will update further details on this by August 30, 2024.


Regards,

Dhanush Sekar



WV Wil van Antwerpen August 29, 2024 08:47 AM UTC

Hello Dhanush,

Meanwhile I found that it does work for "findAll", just not for "find".
Also found a workaround as the "selectionChange" event always triggers for "find", so I use that with an additional boolean that I set whenever I do a find to trigger the "mySearchEvent" from there. 

Not perfect, but it got me a temporary solution.
It would be nice if the issue can be addressed for "find", so that the workaround can be removed.

--
Wil



TV Thamizhselvan Varadharajan Syncfusion Team August 30, 2024 01:15 PM UTC

Hi Will,


For now, Please use the proposed temporary solution. We need to validate the issue further and will share details by September 3, 2024.


Regards,

Thamizhselvan.



SS SalmanBaris ShahulHameed Syncfusion Team September 3, 2024 12:54 PM UTC

Hi Will,

We have confirmed the reported issue 'searchResultsChange event does not fire after search completes' as a defect and logged a defect report. We will fix this issue in our first patch release after 2024 Volume 3 main release which is expected on last week of September, 2024.

 

You can track the status of the bug through the below feedback link:

The searchResultsChange event does not fire after search completes | JavaScript - EJ 2 Forums | Syncfusion

 

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”


Regards,

Salman




WV Wil van Antwerpen September 3, 2024 04:49 PM UTC

Hello SalmanBaris,


Sounds great.

Thank You!
--
Wil


Loader.
Up arrow icon