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
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.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.