alfrescoalfresco-sharealfresco-enterpriseaikau

What is the best way to override a function in an aikau widget in alfresco?


I am using Alfresco 6.2 Enterprise version. I have a requirement which calls for a couple of modifications in https://dev.alfresco.com/resource/docs/aikau-jsdoc/AlfSearchList.js_.html module.

  1. What is the best approach to override the onScopeSelection function?
  2. Is there a way I can modify searchPayload to include a new attribute?

I have gone through Alfresco documentation and couldn not figure out what's the best way to override an existing aikau.


Solution

  • The best option to override a function in Aikau is typically to extend the widget module in question and use module "class hierarchy" to override the function inherited from the AlfSearchList. The OOTBee Support Tools project has an example of a module extending AlfList and overriding its onDataLoadSuccess function. Once you have your own custom module, you can use a Surf Extension Module to customise the JSON model of the faceted search page to change the name of the module used for the search list to yours.

    Unfortunately there is no other way to modify the searchPayload other than overriding the loadData function as well. And then the added attribute would not do anything unless you also override the SearchService's onSearchRequest function and used your custom service instead of the default by again modifying the JSON model of the page.