Expand my Community achievements bar.

SOLVED

Custom menu problem

Avatar

Level 4

I have a customized menu on the assets page. Everything works fine until the user searches for an asset. Then the AEM updates the current menu with the menu defined in /libs/dam/gui/content/commons/sidepanels/search/items/searchpanel/result/header/items/selection . I have redefined that menu in /apps/dam/gui/content/commons/sidepanels/search/items/searchpanel/result/header/items/selection with the selections that were added to the menu. When the page loads, there is javascript that links the menu items with the script to be run when the item is clicked. The problem is that when the new menu replaces the previous one, the links between the script and items is lost. I'm looking for a way to either know when the new items are there to re inject the script or how to upload script with the updated menu that will run and link the menu items to script to be run.

Does anyone have experience doing this?

 

Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi 

Please have a look at some reference documentations for the same:

Link:- http://www.slideshare.net/martinischeery/aem-61-user-interface-customisation

Link:- https://docs.adobe.com/docs/en/aem/6-1/develop/extending/assets/searchx.html

I hope this would act as some help to you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

4 Replies

Avatar

Level 10

Just wondering - are you following any on-line doc for this so ppl can see if its reproducible. 

Avatar

Level 4

I haven't been able to find any documentation that covers it. There may be somewhere but I've had a hell of a time finding documents. I am using AME 6.1 for what it's worth.

I know you can override pages, script, and other settings by creating the same tree under /apps that is under either /etc or /libs then make your changes. The problem is that the AEM uses one menu definition for when viewing the assets then replaces that menu with a new on after a search has completed. The problem is that the javascript that was injected into the menu elements is lost when the search menu is put in place of the original menu.

Avatar

Correct answer by
Administrator

Hi 

Please have a look at some reference documentations for the same:

Link:- http://www.slideshare.net/martinischeery/aem-61-user-interface-customisation

Link:- https://docs.adobe.com/docs/en/aem/6-1/develop/extending/assets/searchx.html

I hope this would act as some help to you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 4

I ended up fixing this by adding my code to the damactions.js file. I made a copy of the standard from Adobe and placed it under the /apps folder as the documents recommend. I did not have to copy all of the script files in the same folder to have the AEM process the damactions.js custom version. 

I then ran into issues with the script loading multiple times. I resolved that by adding my custom script under the $(document).on("foundation-contentloaded" + ns... block. This then loaded my script when the menu section was loaded and then also when it was changed after the search. This made it so that the element was wired up to the code only once when the page was loaded and then associated again when the search menu was loaded.