It happened to me several times, but I imagine it happened to you during the development of a portlet, the need to select a file or folder from Liferay Document Library; something simple at first glance because the core portlets already do this in several points.
But replicate the same behaviour within your own portlet is not so easy and requires several hours of Liferay source code analysis to figure out where to put your hands; those of you who have ever put his hands in the source code of Liferay and especially in AlloyUI source code, knows how frustrating it can be.
Then I started thinking how to solve the problem without having to do copy&paste every time, and the solution I found was to create an AlloyUI module which expose some JavaScript objects to interface with the Document Library; something that free the developer from the details and that could be reused over time.
So I created the liferay-dl-util
module and packed everything with a hook released on the Liferay Marketplace, so that anyone can download and use it immediately.
In this article we will see how to use the JavaScript objects provided by the module to allow the selection of a file or folder from the Liferay Document Library.
The extension is available on Liferay Marketplace: Document Library JS Util