- Home
- Forum
- JavaScript - EJ 2
- The searchResultsChange event does not fire after search completes
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
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
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
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.
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:
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
Hello SalmanBaris,
Sounds great.
Thank You!
--
Wil
- 5 Replies
- 4 Participants
-
WV Wil van Antwerpen
- Aug 27, 2024 05:01 PM UTC
- Sep 3, 2024 04:49 PM UTC