How do I override AlfSearchResult aikau widget function in aikau-

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

How do I override AlfSearchResult aikau widget function in aikau-

I would like to change the order and behavior of the displayname and title nodes in the search results page in the community alfresco-201711 version.  I would like Title to be clickable instead of the displayname, and I would like the displayname to not be clickable.

I think I just need to override the 'createDisplayNameRenderer' and the 'createTitleRenderer' functions that are in the FCTSRCH_SEARCH_RESULT widget.  I am currently adding widgets to the widgetsBelow list by extending the faceted-search.get.js like:

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

fctSearchRes.config.widgetsBelow = [
    name: "alfresco/renderers/Property",
    config: {
            propertyToRender: "pageCount",
            simple: true,
            label: "Page Count",
            renderOnNewLine: true,
            renderSize: "medium"

would I do something similar for the functions? Something like:

fctSearchRes.config.createTitleRenderer = function alfresco_search_AlfSearchResult__createTitleRenderer() {
    // jshint nonew:false
    if (!this.currentItem.title)
       domClass.add(this.titleNode, "hidden");
       new Property({
          id: + "_TITLE",
          currentItem: this.currentItem,
          pubSubScope: this.pubSubScope,
          propertyToRender: "title",
          renderSize: "small",
          renderedValuePrefix: "((((",
          renderedValueSuffix: "))))",
          highlightValue: this.highlightValue,
          highlightPrefix: this.showSearchTermHighlights ? this.highlightPrefix : null,
          highlightPostfix: this.showSearchTermHighlights ? this.highlightPostfix : null
       }, this.titleNode);

The jsdocs say that the functions can be overridden, but I haven't figured how, or if that is the right approach.



1 Reply

Re: How do I override AlfSearchResult aikau widget function in aikau-

You cannot override functions via the server-side JSON config. This is just for simple property configuration and widget composition. In order to override the function, you'd need to extend the widget module in client-side JavaScript and specify that extended module via the "widget" configuration property instead of the AlfSearchResult one.