How to pass values to embedded widget
This content was last updated in 2022. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 06:40 AM
Hi Team ,
I have cloned OOB widget "Faceted Search" and modified to embed clone of "Search page" widget.
Search page widget is not getting updated when I search something and need to reload the form again to see the data.
I am using below line to call the widget
<sp-widget widget="data.widget"></sp-widget>
and below is the server script of the embedded widget
the data.q is taking only for the first time , but next time it doesn't work and I need to refresh it.
Any help on this would be much appreciated.
Thanks,
Feddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 07:17 AM
Hi,
Can you please give more details? Do you want to refresh it after clicking button? if yes share the code and expected ouput
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2022 09:57 PM
Please refer images below,
When I search a keyword from homepage it takes us to search page , you can notice that the typeahead widget has outlook key word and the URL also updated with q=outlook, and the quickhelp displays result for key outlook.
when I enter other key word (ex : Password) in typeahead widget , the URL gets updated and rest of the tab like(knowledge, catalog item) displays respective results whereas the quickhelp tab still displays old resutls.
I have embedded our custom search page widget to clone of "Faceted widget" using below way
1. custom "Faceted Search" widget
HTML :
<div ng-if="c.data.showQuickHelp">
<sp-widget widget="data.widget"></sp-widget>
<div>
server script :
data.widget = $sp.getWidget('xxx_search_page');
2. custom "Search Page"(xxx_search_page) widget
server script :
data.q = encodeURIComponent($sp.getParameter('q'));
I would like to take key word entered in the typeahead widget or from the URL and pass it to data.q ..
Thanks!