Expand my Community achievements bar.

SOLVED

omni search client library dependency

Avatar

Level 4

We have a new button in the global nav which has a class assigned using granite:rel. We have a Client Library javascript code which listens to the click event for that button and calls the our javascript. In our javscript ClientLib, we have assigned the categories as - dam.gui.coral.metadataeditor,granite.ui.coral.foundation so that our javascript function gets call when these categories are loaded on the page. This call works fine when we are browsing the DAM assets. However when we do the omnisearch even though our button is available in the global nav through overlay, but the java script is not available when we click onto the button.

We are wondering what dependencies we should be adding so that our custom javascript file is available for omni search as well. We tried adding several search related dependencies but no luck.   If this is not possible then what options do we have so that we can inject and make our javascript file for the omni search.

Any help will be great. Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 4

We found that our element was getting loaded after the java script loaded and that is why it was not working.  So instead of binding the event on the element like

$(".my_button_class").click(function() {...

we had to do like -

$(document).on('click',"my_button_class", function()) {...

and this has fixed the issue.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 4

We found that our element was getting loaded after the java script loaded and that is why it was not working.  So instead of binding the event on the element like

$(".my_button_class").click(function() {...

we had to do like -

$(document).on('click',"my_button_class", function()) {...

and this has fixed the issue.