Custom action not recognized when called from Aikau menu item

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member II

Custom action not recognized when called from Aikau menu item

Jump to solution

I have created new "Selected items" drop down item in faceted search page. When I click on the item it should call action which I have created as a custom action in a document library. Unfortunately it does not work. Action is not called. I tried to place Alfresco predefined action "download as a Zip" and it works. Below you can find code related to this functionality:

-extension.xml

<config evaluator="string-compare" condition="DocumentLibrary">
    <multi-select>
        <action type="action-link"
                  
id="myAction" />
    </multi-select>
</config>
<config evaluator="string-compare" condition="DocLibCustom" replace="true">
        <dependencies>
            <js src="/components/documentlibrary/custom-actions.js" />
    </dependencies>
</config>

faceted-search.get.js

var itemsAction = widgetUtils.findObject(model.jsonModel, "id", "SELECTED_ITEMS_ACTIONS_GROUP");
if (itemsAction != null) {
    itemsAction.config.widgets.push({
        id: "myAction",
        name: "alfresco/documentlibrary/AlfDocumentActionMenuItem",
        config: {
            label: "button",
            type: "action-link",
            permission: "",
            asset: "",
            href: "",
            hasAspect: "",
            notAspect: "",
            publishTopic: "ALF_SELECTED_DOCUMENTS_ACTION_REQUEST",
            publishPayload: {
                action: "myAction"
            }
        }
    });
}

custom.actions.js

YAHOO.Bubbling.fire("registerAction", {
    actionName: "myAction",
    fn: function custom_myAction(record)
    {
      ...
    }

myAction is called from Document library and it works perfect. What can I do to make Alfresco recognize myAction in faceted-search too?

1 Solution

Accepted Solutions
Highlighted
Master

Re: Custom action not recognized when called from Aikau menu item

Jump to solution

You have to realise that the Document Library and Faceted Search pages are built on completely different UI foundations. The Document Library is built using YUI2 while Faceted Search is using Aikau. There is no automatic interoperability between the two. The custom doclib JS are not even loaded in the Faceted Search page, let alone being integrated with the Aikau widgets. You'll have to write a custom Aikau client-side service module to handle a publication on a custom topic, and then execute the logic of your action. This will require duplicating the code of your custom JS.

View solution in original post

3 Replies
Highlighted
Master

Re: Custom action not recognized when called from Aikau menu item

Jump to solution

You have to realise that the Document Library and Faceted Search pages are built on completely different UI foundations. The Document Library is built using YUI2 while Faceted Search is using Aikau. There is no automatic interoperability between the two. The custom doclib JS are not even loaded in the Faceted Search page, let alone being integrated with the Aikau widgets. You'll have to write a custom Aikau client-side service module to handle a publication on a custom topic, and then execute the logic of your action. This will require duplicating the code of your custom JS.

View solution in original post

Highlighted
Active Member II

Re: Custom action not recognized when called from Aikau menu item

Jump to solution

Thank you a lot Axel. Finally I solved it with the help of your coordination.

Highlighted
Senior Member II

Re: Custom action not recognized when called from Aikau menu item

Jump to solution

How did you solved?can you help me.

Thanks & Regards,
Sanjay