AdaptiveCardsStudio icon indicating copy to clipboard operation
AdaptiveCardsStudio copied to clipboard

[BUG]: Preview does not render array bound elements

Open garrytrinder opened this issue 3 years ago • 1 comments

We can use the $data property to repeat elements using an array of data, this is documented in the below Microsoft Docs page under the section Repeating items in an array.

https://docs.microsoft.com/en-us/adaptive-cards/templating/language#repeating-items-in-an-array

Given the following template and sample test data, a FactSet is used to render the displayName and userPrincipalName which has an array of User objects bound to the $data property of the FactSet object.

The preview does not render the list or values.

image

It is however correctly rendered in the AdaptiveCards.io designer when the Preview Mode is enabled.

image

I am suggesting that this is a bug due to the answer from @DeeJayTC on the below StackOverflow post which suggests that rendering of array bound elements is possible.

If you need a design time experience for array bound elements you can use Adaptive Cards Studio the Visual Studio Code Extension for card authoring.

https://stackoverflow.com/a/63233919/4871999


Template

{
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.4",
  "body": [
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${users}",
          "title": "${displayName}:",
          "value": "${userPrincipalName}"
        }
      ]
    }
  ]
}

Data

{
    "users": [
        {
            "displayName": "Lidia Holloway",
            "userPrincipalName": "[email protected]"
        },
        {
            "displayName": "MOD Administrator",
            "userPrincipalName": "[email protected]"     
        },
        {
            "displayName": "Isaiah Langer",
            "userPrincipalName": "[email protected]"
        }
    ]
}

garrytrinder avatar Aug 12 '22 13:08 garrytrinder

Thanks! Gotta check again if i can fix that...been a while since i posted that.

DeeJayTC avatar Aug 12 '22 13:08 DeeJayTC