Liferay 6.1 dynamic data list in velocity

1.9k Views Asked by At

I build some custom views for DDL. For text type fields i'd iterate through records and display just like below:

$record.getField("field_name").getValue()

This won't work for the date field. I presume I should use getRenderedValue(themeDisplay) method instead of getValue()

I can access themeDisplay in velocity markup through request.get("theme-display"), however if i set it as variable and pass as argument to getRenderedValue method I get no result

Is this the right way to do it? Whats the best practice to obtain themeDisplay in velocity markup?

1

There are 1 best solutions below

0
On

I think it should work when you iterate through the records. I presume, before iterating you have done

$serviceLocator.findService("com.liferay.portlet.dynamicdatalists.service.DDLRecordLocalService"))
#set ($recordSetId = $getterUtil.getLong($reserved_record_set_id.data))
#set ($records = ${ddlRecordsUtil.getRecords($recordSetId)})

1st Check: Can you print records? If No, Can you please check that you have added this property in your portal-ext.properties file?

journal.template.velocity.restricted.variables=

By default it will be

journal.template.velocity.restricted.variables=serviceLocator

you need to remove serviceLocator and then try?

HTH