I have configured new multi-select button in the document library:
When the button is clicked it should execute javascript function onActionAddToList which later calls bean function insert. Everything works except the bean function - it is not called/recognized. Am I doing something wrong? I am wondering if I should configure bean in an other place? I'm using Alfresco 5.2.0 SDK 3.0.1 Below you can find corresponding code:
<!-- /alfresco/web-extension/site-data/extensions/my-extension.xml in share-jar -->
<configurations>
<config evaluator="string-compare" condition="DocumentLibrary">
<multi-select>
<action type="action-link" id="onActionAddToList" icon="document-approve" label="Add item to a list" />
</multi-select>
</config>
<config evaluator="string-compare" condition="DocLibCustom" replace="true">
<dependencies>
<js src="/components/documentlibrary/custom-documentlibrary-actions.js" />
</dependencies>
</config>
</configurations>
<!-- resources/components/documentlibrary/custom-documentlibrary-actions.js in share-jar
YAHOO.Bubbling.fire("registerAction", {
actionName: "onActionAddToList",
fn: function custom_onActionAddToList(record)
{
Alfresco.util.PopupManager.displayMessage({ title: "Info", text: listManagement.insert("Hello")});
}
});
<!-- alfresco/module/project/context/service-context.xml in platform-jar -->
<beans>
<bean id="com.test.actions.ListManagement" class="com.test.actions.ListManagement" parent="baseJavaScriptExtension">
<property name="extensionName" value="listManagement"/>
</bean>
</beans>
<!-- java/com/test/actions/ListManagement.java in platform-jar -->
public class ListManagement extends BaseProcessorExtension {
public String insert(String text) {
return text;
}
}
Please refer this question and refer this documentation to call javabacked actions.