Hi, I'm trying applyComponents function on rich text items (such as a!richTe

Hi, I'm trying applyComponents function on rich text items (such as a!richTextItem, a!richTextNumberedList, etc) by applying it on the 'value' of a!richTextField but it doesn't return anything at all. Does applyComponents doesn't work on rich text items?

Below is the snippet of my codes.

OriginalPostID-218581

OriginalPostID-218581

  Discussion posts and replies are publicly visible

Parents
  • We have faced this issue in the past. When the applyComponents return a list of variant instead of a single component we have a problem. In our case we were trying to return an array of check box and fileUpload field combination and render it in a sectionLayout. Due to this limitation we moved the sectionLayout inside the applyComponents and started returning list of sectionLayout (which inturn contains the two components). This way applyComponents will return only one component in a single loop.

    In your case you can try the same like given below,

    a!applyComponents(
    function: rule!loopingRichTextItems(
    _,
    {
    1,
    2,
    3
    }
    ),
    array: {
    1,
    2,
    3,
    4
    }
    )

    rule!loopingRichTextItems

    a!richTextDisplayField(
    value: {
    a!richTextItem(
    text: "Header " & ri!header
    ),
    a!richTextNumberedList(
    items: ri!detail
    )
    }
    )


Reply
  • We have faced this issue in the past. When the applyComponents return a list of variant instead of a single component we have a problem. In our case we were trying to return an array of check box and fileUpload field combination and render it in a sectionLayout. Due to this limitation we moved the sectionLayout inside the applyComponents and started returning list of sectionLayout (which inturn contains the two components). This way applyComponents will return only one component in a single loop.

    In your case you can try the same like given below,

    a!applyComponents(
    function: rule!loopingRichTextItems(
    _,
    {
    1,
    2,
    3
    }
    ),
    array: {
    1,
    2,
    3,
    4
    }
    )

    rule!loopingRichTextItems

    a!richTextDisplayField(
    value: {
    a!richTextItem(
    text: "Header " & ri!header
    ),
    a!richTextNumberedList(
    items: ri!detail
    )
    }
    )


Children
No Data