AnsweredAssumed Answered

How to restrict menu option only for folders in alfresco Search using Aikau

Question asked by shyam2016 on Nov 9, 2016
Latest reply on Nov 10, 2016 by ddraper


we have implemented one functionality to calculate the size of assets in search component.

So if user select folder in search result page then only calculate size option should display, but problem is even if user selects the file or document calculate size option is displaying.

below is the sample code.


var calCulateSizewidget = {

   name: "alfresco/menus/AlfSelectedItemsMenuItem",

   config: {

  label: msg.get("calculate.size.folders"),

  clearSelectedItemsOnClick: true,





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

var widget3 = widgetUtils.findObject(model.jsonModel.widgets, "id", "CUSTOM_SELECTED_MENU");

function  showCalculateSizeforGroup(group,calCulateSizewidget){

if(widget2.config.onFolderSelection === true)





I have tried extending the AlfSelectedItemmenuItem.js

onItemsSelected: function alfresco_menus_AlfSelectedItemsMenuItem__onItemsSelected(payload) {

   alert(" payload "+payload);

         if (payload.selectedItems)


            if (!this.publishPayload)


               this.publishPayload = {};


  var records = payload.selectedItems;

  var newPayload = [];

  for(var i = 0; i < records.length; i++)


  if(records[i].type == "folder")


  onFolderSelection = true;

  console.log("record payload"+records[i]);




            this.publishPayload.selectedItems = newPayload;




Please let me know if i am missing anything.

Thanks !