Message Boards

DDMFormFieldOptions getOptionsValues not working with Grid type field

Matias A., modified 2 Years ago.

DDMFormFieldOptions getOptionsValues not working with Grid type field

New Member Posts: 2 Join Date: 9/12/20 Recent Posts

Hello!
In Liferay 7.3, we were able to retrieve the option labels for a "Single Selection" type field in a Form using "getOptionsValues" ,as seen in the following code:
options =  form_field.getDDMFormFieldOptions();
Map<String,LocalizedValue> optionsMap =  options.getOptions() ;Set<String> values = options.getOptionsValues()
System.out.println("Valores: " + values.size());
System.out.println("List labels and options");
    for (Entry<String, LocalizedValue> entry : optionsMap.entrySet()) {
        System.out.println(entry.getKey() + "=" + entry.getValue().getString(entry.getValue().getDefaultLocale())  );
    }Output was:Valores: 2
List labels and options
Opción28394120=o1
Opción68135863=o2


However, the same code applied to a "Grid" type field, returns a map of 0 values:Valores: 0
List labels and optionsThe question is, How can we retrieve the options and respective labels for a grid type field ?

 

Regards