04-08-2020 03:55 AM
I am trying to display new dropdown in aikau search result beside existing dropdown with my custom action.
Below Code I have tried and I am succeed to display.
model.jsonModel.services.push("search/owner");
var menubar = widgetUtils.findObject(model.jsonModel.widgets, "id","FCTSRCH_SEARCH_LIST_MENU_BAR");
if (menubar && menubar.config && menubar.config.widgets) {
menubar.config.widgets.unshift({
id : "SELECTED_ITEMS_MENU",
name : "alfresco/documentlibrary/AlfSelectedItemsMenuBarPopup",
config : {
label : "Selected Items...",
itemKeyProperty : "nodeRef",
widgets : [ {
id : "SELECTED_ITEMS_ACTIONS_GROUP",
name : "alfresco/menus/AlfMenuGroup",
config : {
widgets : [ {
name : "alfresco/documentlibrary/AlfDocumentActionMenuItem",
config : {
id : "owner",
label : "Action 1",
iconImage : "",
type : "action-link",
permission : "",
asset : "",
href : "",
hasAspect : "",
notAspect : "",
publishTopic : "CUSTOM_TOPIC",
publishPayload: {
}
}
} ]
}
} ]
}
});
menubar.config.widgets.unshift({
name : "alfresco/documentlibrary/AlfSelectDocumentListItems",
config : {
widgets : [ {
name : "alfresco/menus/AlfMenuGroup",
config : {
widgets : [ {
name : "alfresco/menus/AlfMenuItem",
config : {
label : "select.all.label",
publishTopic : "ALF_DOCLIST_FILE_SELECTION",
publishPayload : {
label : "select.all.label",
value : "selectAll"
}
}
}, {
name : "alfresco/menus/AlfMenuItem",
config : {
label : "select.none.label",
publishTopic : "ALF_DOCLIST_FILE_SELECTION",
publishPayload : {
label : "select.none.label",
value : "selectNone"
}
}
} ]
}
} ]
}
});
}
var searchresult = widgetUtils.findObject(model.jsonModel.widgets, "id","FCTSRCH_SEARCH_RESULT");
if (searchresult && searchresult.config) {
searchresult.config.showSelector = true;
}owner.js
define([ "dojo/_base/declare", "dijit/_WidgetBase", "alfresco/core/Core",
"dojo/_base/lang" ], function(declare, _Widget, Core, lang) {
return declare([ _Widget, Core ], {
constructor : function constructor(args) {
this.alfSubscribe("CUSTOM_TOPIC", lang.hitch(this,this._onPayloadReceive));
},
_onPayloadReceive : function(payload) {
console.log(payload);
}
});
});When I click on Action 1, I am able to subscr that ibe topic in my service file which is owner.js
My question is How Can I pass selected items(or noderef) in my service?I want to get noderef of selected documents.
Explore our Alfresco products with the links below. Use labels to filter content by product module.