Skip to content
This repository has been archived by the owner on Oct 17, 2020. It is now read-only.

Generated portlet won't display values because of wrong data type in configuration #545

Closed
IstvanD opened this issue Mar 17, 2020 · 4 comments
Assignees
Labels
Milestone

Comments

@IstvanD
Copy link
Member

IstvanD commented Mar 17, 2020

Replace the configuration file contents features/configuration.json with the following:

​{
 "$schema": "https://raw.githubusercontent.com/liferay/liferay-js-toolkit/master/resources/schemas/configuration.schema.json",

 "portletInstance": {
  "fields": {
      "drink": {
        "type": "float",
        "name": "drink",
        "description": "drink-help",
        "default": "10.5"
      }
  }
 }
}

Deploy the portlet. Open it's configuration. It won't show any input fields for "drink"

The reason is that in the generated .jar, in features/portlet_preferences.json, this part of the code

    {
      "name": "drink",
      "label": {},
      "dataType": "double",
      "type": "ddm-decimal",
      "tip": {
        "": "Choose the drink you like the most"
      },
      "predefinedValue": {
        "": "10.5"
      }
    }

has "ddm-decimal" set as "type".
Liferay uses soy to render the field. The rendering template in modules/apps/dynamic-data-mapping/dynamic-data-mapping-form-field-type/src/main/resources/META-INF/resources/Numeric/NumericRegister.soy

{namespace NumericRegister}

{deltemplate PageRenderer.RegisterFieldType variant="'numeric'"}
	{call Numeric.render data="all" /}
{/deltemplate}

will only take "numeric" fields as it's params.
The "type" in features/portlet_preferences.json has to be generated as "numeric" instead of "ddm-decimal".

LPS-109702 has been opened on this issue.

@izaera izaera self-assigned this Mar 25, 2020
@izaera izaera added the bug label Mar 25, 2020
@izaera izaera added this to the next-version milestone Mar 25, 2020
@izaera
Copy link
Member

izaera commented Mar 25, 2020

"Numeric" doesn't work either.

@izaera
Copy link
Member

izaera commented Mar 25, 2020

It does, but I also need to change it in integer fields.

@IstvanD
Copy link
Member Author

IstvanD commented Mar 25, 2020

Hi @izaera

Maybe it is case sensitive? Have you tried "numeric" (not with capital N)?

@izaera
Copy link
Member

izaera commented Mar 25, 2020

@IstvanD we posted at the same time 😅. See #545 (comment)

izaera added a commit that referenced this issue Mar 26, 2020
fix: #545 Generated portlet won't display values because of wrong data type in configuration
@izaera izaera closed this as completed in 7b363b6 Mar 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants