Cookies help us deliver our services.

By using our services, you agree to our use of cookies. Learn more

I understand

Article Index

Finally let's see the code to be inserted at the bottom of the JSP page to initialize and use the component to select a folder from the Liferay Document Library.

<aui:script use="liferay-dl-util">
    new Liferay.DLUtil.FolderSelector({
/* HTML container name set above */
container: '#<portlet:namespace/>folderSelector',
/* CSS selector to identify the field to fill in the folderId */
hiddenInput: '#<portlet:namespace/>folderId',
/* events provided by the widget */
on: { click: function(button, event) { /*
* Function invoked at the button click, before the dialog opens; insert here your code if needed
*/ }, select: function(folderId, folderName, isSupportMetaData, isSupportSocial) {
* Function invoked "after" file selection; insert here your code in case you need informations
* other than simple the document UUID

// this sample code only display, inside the textarea above, all the informations provided by
// the widget
var area ='#<portlet:namespace/>folderArea'); var msg = 'FolderId: ' + folderId + '\n' + 'FolderName: ' + folderName + '\n' + 'IsSupportMetaData: ' + isSupportMetaData + '\n' + 'IsSupportSocial: ' + isSupportSocial; area.val(msg); } } }).render(); </aui:script>