1

I'm experimenting with Dynamic Data Lists in Liferay 6.1. The data definitions and list editors work fine, but I'm having trouble preparing a template to display the list. In particular I'm wondering how to implement sorting and pagination of the display, as the list eventually grows very long.

Let's start with ordering. Theoretically the template below should use the getRecords method which allows for an OrderByComparator ( http://bit.ly/MqsGNE ), but where is the factory, which would allow me to create the needed comparator?

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

## How to create an OrderByComparator which would ORDER_BY_text2132_DESC ??

#set ($orderBy = ???????????)
#set ($records = ${ddlRecordsUtil.getRecords($recordSetId,-1,-1,50, $orderBy)}) 

<ul> 
#foreach ($record in $records)

    #set ($name = $record.getField("text2132").getValue()) 

    <li><em>${name}</em></li> 

#end 
</ul>

Am I missing something, is there another approach to sorting these lists before they are fetched from the database?

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
postrational
  • 6,306
  • 3
  • 22
  • 27

1 Answers1

0
#set ($records = ${ddlRecordsUtil.getRecords($recordSetId,-1,-1,50,ORDER_BY_text2132_DESC)}) 

Try this, this will work.

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
Boat
  • 515
  • 2
  • 8
  • 28