6

Are there standard events to capture the search term entered and search button clicked in the standard Napili template so that I can get search term entered and build my own lightning component with search term entered ?

Please see attached screenshot .Basically the aim is to capture the standard lightning event thats been published when user clicked search term on the header and call an API with search term entered ?

enter image description here

  • Have you tried adding a js listener to the search term text box -- or search button -- to intercept and execute your own logic ? Doubt there are standard components to execute this custom behaviour. – CloudHugger Jan 16 '16 at 0:45
  • how can i add a Js listener inside lightning container ? – Mohith Shrivastava Jan 16 '16 at 0:46
  • On your button can you add a onclick="javascript:alert('test');" to test out ? Not sure if can or cant just suggesting sorry. Am also on mobile or would try myself first - sorry! – CloudHugger Jan 16 '16 at 1:02
  • Button is not under my control .. – Mohith Shrivastava Jan 16 '16 at 1:03
  • 1
    Understood. Good luck with it 👍 – CloudHugger Jan 16 '16 at 2:51
4

I had to get on a call with Salesforce Engineer to really understand this .This is what we concluded

We can create a design file for the lightning components and use the same merge values as other components use on the page .In this case i can simple go to the Search detail page and check the standard context variable

enter image description here

In the above screenshot I have variables like "{!searchString}" and "{!topicName}" .I will need a design file for these attributes and community admin needs to use the same strings so that my lightning component can access it .

Here is a blogpost i wrote on this topic with some detail insight

http://cloudyworlds.blogspot.com/2016/01/customizing-napili-template-of-sfdc-for.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.