AnsweredAssumed Answered

Extending the Aikau Search page (faceted-search)

Question asked by voula_11 on Jun 18, 2015
Latest reply on Mar 12, 2018 by birundha

I am customizing Alfresco Share and one of my tasks is to make the Search Results paginated instead of an infinite scroll. I am on Community 5.0.d with Aikau version

So far, I've downloaded the faceted-search JAR from the Developer View in the faceted search page and have the following code:

// get the search results list
var searchResultsList = widgetUtils.findObject(model.jsonModel.widgets, "id", "FCTSRCH_SEARCH_RESULTS_LIST");
if (searchResultsList){
   // disable infinite scroll
   searchResultsList.config.useInfiniteScroll = false;
   // remove the Gallery View and the infinite scroll View

// create the paginator menu bar
var pagination = {
   name: "alfresco/documentlibrary/AlfDocumentListPaginator",
   align: "right"
// get the existing menu bar
var menuBar = widgetUtils.findObject(model.jsonModel.widgets, "id", "FCTSRCH_RESULTS_MENU_BAR");
if (menuBar) {
   // remove the View Selection widget (we only want one paginated view)
   // add the paginator widget

The widget shows up, and only the first 25 results are shown. However, I get the following error (and thus cannot navigate between pages):

alfresco/core/CoreWidgetProcessing[createWidget] >> The following error occurred creating a widget TypeError: Cannot read property 'totalDocuments' of undefined
    at alfresco_documentlibrary_AlfDocumentListPaginator__processLoadedDocuments [as processLoadedDocuments] (
    at alfresco_documentlibrary_AlfDocumentListPaginator__allWidgetsProcessed [as allWidgetsProcessed] (
    at alfresco_core_CoreWidgetProcessing___registerProcessedWidget [as _registerProcessedWidget] (
    at runFactory (
    at execModule (
    at guardCheckComplete (
    at contextRequire (
    at req (
Object {_attachPoints: Array[1], _attachEvents: Array[0], _connects: Array[0], _supportingWidgets: Array[0], id: "alfresco_documentlibrary_AlfDocumentListPaginator___fc29981b-ab52-48d0-8e9b-f31e57bc9c46"…}

The line where the error occurs:
processLoadedDocuments: function alfresco_documentlibrary_AlfDocumentListPaginator__processLoadedDocuments(payload) {
         if (payload.totalDocuments !== null && payload.startIndex !== null)

I've been stuck on this for days, and I can't figure out why the payload being passed to this function is undefined.

Is it because the FCTSRCH_SEARCH_RESULTS_LIST has to publish a topic that the Paginator has to subscribe to in order to get all the necessary information for the widget? How do I do this?

Any help would be appreciated.