AnsweredAssumed Answered

How do I override AlfSearchResult aikau widget function in aikau-1.0.101.5

Question asked by dbiggins on Nov 29, 2017
Latest reply on Nov 30, 2017 by afaust

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",
    id: "FCT_SEARCH_RESULTS_PAGE_COUNT",
    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");
    }
    else
    {
       new Property({
          id: this.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.

 

Thanks!

Dan

Outcomes