我们正在分面搜索屏幕 5.1+aikau(100.0.1) 的 Selected Items 菜单中添加一些自定义操作;
但是当我加载页面时,在自定义小部件 postCreate 方法中调用了两次,当我选择“编辑属性”时,onSelectedDocumentsAction 函数也调用了两次。
如果我在 selectedItemsActionsGroup 中再推一个额外的项目,那么它的调用次数(3 次)。
var selectedItemsActionsGroup = widgetUtils.findObject(model.jsonModel.widgets,"id", "SELECTED_ITEMS_ACTIONS_GROUP");
selectedItemsActionsGroup.config.widgets.push(
{
id : "OnActionEditProperties",
name : "faceted-search/CustomBulkSelectItems/CustomBulkSelectItems",
config : {
label : "Edit",
iconImage : url.context
+ "/res/components/documentlibrary/actions/y-16.png",
type : "action-link",
permission : "",
asset : "",
href : "",
hasAspect : "",
notAspect : "",
publishTopic : "BULK_OPS",
publishPayload : {
action : "onActionEditProperties",
}
}
},
{
id : "OnActionManaged",
name : "faceted-search/CustomBulkSelectItems/CustomBulkSelectItems",
config : {
label : "Managed",
iconImage : url.context
+ "/res/components/documentlibrary/actions/x-16.png",
type : "action-link",
permission : "",
asset : "",
href : "",
hasAspect : "",
notAspect : "",
publishTopic : "BULK_OPS",
publishPayload : {
action : "OnActionManaged",
}
}
});
*****************
CustomBulkSelectItems.js
**********************
define(["dojo/_base/declare",
"alfresco/services/FormsRuntimeService",
"alfresco/core/UrlUtilsMixin",
"alfresco/enums/urlTypes",
"alfresco/core/Core",
"alfresco/menus/AlfFilteringMenuItem",
"alfresco/documentlibrary/_AlfDocumentListTopicMixin",
"alfresco/core/CoreXhr",
"dojo/_base/lang",
"dojo/dom-class",
"dojo/_base/array",
"service/constants/Default","alfresco/core/topics"],
function(declare,FormsRuntimeService, UrlUtilsMixin,urlTypes,AlfCore ,AlfFilteringMenuItem, _AlfDocumentListTopicMixin,AlfCoreXhr, lang, domClass,
array, AlfConstants,topics) {
return declare([FormsRuntimeService,UrlUtilsMixin,AlfCore,AlfFilteringMenuItem,_AlfDocumentListTopicMixin,AlfCoreXhr], {
i18nRequirements: [ {i18nFile: "./CustomBulkSeledtItems.properties"} ],
postCreate: function alfresco_documentlibrary_CustomBulkSelectItems__postCreate() {
console.log(" bulkops postCreate************.");
this.alfSubscribe("BULK_OPS", lang.hitch(this, this.onSelectedDocumentsAction));
this.inherited(arguments);
} ,
/**
* This function handles requests to perform actions on the currently selected documents. It takes the
* provided payload and updates it with the
*
* @instance
* @param {object} payload The payload containing the details of the action being requested
* @fires alfresco/core/topics#MULTIPLE_ITEM_ACTION_REQUEST
*/
onSelectedDocumentsAction: function alfresco_documentlibrary_CustomBulkSelectItems__onSelectedDocumentsAction(payload) {
console.log(" bulkops onSelectedDocumentsAction************.");
}
});
});