Skip to content

Instantly share code, notes, and snippets.

@ambrinchaudhary
Created April 12, 2023 07:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ambrinchaudhary/68010607de588819485f017f14d6a6c0 to your computer and use it in GitHub Desktop.
Save ambrinchaudhary/68010607de588819485f017f14d6a6c0 to your computer and use it in GitHub Desktop.
POC - Use of Frontend DataSet in D&M
compileOnly project(":apps:frontend-data-set:frontend-data-set-api")
compileOnly project(":apps:frontend-data-set:frontend-data-set-taglib")
package com.liferay.document.library.web.internal.frontend.data.set.view;
import com.liferay.frontend.data.set.view.FDSView;
import com.liferay.frontend.data.set.view.table.BaseTableFDSView;
import com.liferay.frontend.data.set.view.table.FDSTableSchema;
import com.liferay.frontend.data.set.view.table.FDSTableSchemaBuilder;
import com.liferay.frontend.data.set.view.table.FDSTableSchemaBuilderFactory;
import java.util.Locale;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
/**
* @author Ambrin Chaudhary
*/
@Component(
property = "frontend.data.set.name=DLFDSHeadlessId",
service = FDSView.class
)
public class DLTableFDSView extends BaseTableFDSView {
@Override
public FDSTableSchema getFDSTableSchema(Locale locale) {
FDSTableSchemaBuilder fdsTableSchemaBuilder =
_fdsTableSchemaBuilderFactory.create();
return fdsTableSchemaBuilder.add(
"name", "name",
fdsTableSchemaField -> fdsTableSchemaField.setContentRenderer(
"actionLink")
).add(
"typeLabel", "type"
).build();
}
@Reference
private FDSTableSchemaBuilderFactory _fdsTableSchemaBuilderFactory;
}
<%@
taglib uri="http://liferay.com/tld/frontend-data-set" prefix="frontend-data-set" %>
<div class="frontend-data-set-headless">
<frontend-data-set:headless-display
apiURL="/o/headless-delivery/v1.0/sites/20119/document-folders"
formName="fm"
id="DLFDSHeadlessId"
style="fluid"
/>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment