cancel
Showing results for 
Search instead for 
Did you mean: 

Aikau Search Result - Custom Action

sanjaybandhaniya
Elite Collaborator
Elite Collaborator

I am trying to add custom action in Aikau search result Page.

I am using sdk2 for testing.

Below thing I have tried.

Extension File : 

 <extension>
	<modules>
		<module>
			<id>Add custom action in search result page</id>
			<version>1.0</version>
			<auto-deploy>true</auto-deploy>
			<customizations>
				<customization>
					<targetPackageRoot>org.alfresco.share.pages.faceted-search
					</targetPackageRoot>
					<sourcePackageRoot>com.example.faceted-search</sourcePackageRoot>
				</customization>
			</customizations>
		</module>

<module>
      <id>aikau-share - Example Aikau Widgets</id>
      <version>1.0</version>
      <auto-deploy>true</auto-deploy>
      <configurations>
        <config evaluator="string-compare" condition="WebFramework" replace="false">
          <web-framework>
            <dojo-pages>
              <packages>

                <package name="search" location="js/search"/>
              </packages>
            </dojo-pages>
          </web-framework>
        </config>
      </configurations>
    </module>


	</modules>
</extension> 

faceted-search.get.js

var searchResultPage = widgetUtils.findObject(model.jsonModel.widgets, "id", "FCTSRCH_SEARCH_RESULT");

if(searchResultPage != null) {
    searchResultPage.config = {
        enableContextMenu : false,
        mergeActions : true,
        additionalDocumentAndFolderActions : ["example-action"]
    }
}

model.jsonModel.widgets.push({
    name: "search/action"
});

It is not adding custom action in Search result page.

Help Will be appreciated.

@ddraper @afaust 

1 REPLY 1

sanjaybandhaniya
Elite Collaborator
Elite Collaborator

The code working but my mistake is I am providing different id in above code.

You need to provide same id which you have provided in share custom action.

ex

if(searchResultPage != null) {
    searchResultPage.config = {
        enableContextMenu : false,
        mergeActions : true,
        additionalDocumentAndFolderActions : ["example-action"]
    }
}