11-29-2017 04:38 PM
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
11-30-2017 03:49 AM
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.
Explore our Alfresco products with the links below. Use labels to filter content by product module.