for loop within a custom card template

Varaibles don't seem to display when using remote data and a custom template

I have the following within my custom card template.
AssigneeList is an json object within the returned json for each card detail.

<div>
${for(Assignee of AssigneeList)}
<div>
${Assignee.hruserID}
</div>
${/for}
</div>

1 Reply 1 reply marked as answer

BS Balasubramanian Sattanathan Syncfusion Team September 23, 2020 03:20 PM UTC

Hi Chris Loelke, 

Greetings from Syncfusion Support. 

We have validated your requirement “for loop within a custom card template” at our side and let you know that we can only access the card data inside the cardTemplate. If the AssigneeList is not in the card data and it will be an undefined value in the loop. We have prepared a sample based on your requirement by making use of the below code snippet. And we would suggest you to refer the below UG links to know more details about the cardTemplate. 

Datasource
{ 
    "Id": "Task 1", 
    "Title": "Task - 29001", 
    "Status": "Open", 
    "Summary": "Analyze the new requirements gathered from the customer.", 
    "Type": "Story", 
    "Priority": "Low", 
    "Tags": "Analyze,Customer", 
    "Estimate": 3.5, 
    "Assignee": "Nancy Davloio", 
    "RankId": 1, 
    "Color": "#02897B", 
    "ClassName": "e-story, e-low, e-nancy-davloio", 
    "AssigneeList": [ 
      "Assignee 1", 
      "Assignee 2" 
    ] 
  } 

HTML: 
<tr> 
    <td class="CardHeader">Type:</td> 
    <td> 
      ${for(Assignee of AssigneeList)} 
      <div>${Assignee}</div> 
      ${/for} 
    </td> 
</tr> 


Kindly try the above solution and let us know if you need further assistance. 

Regards, 
Balasubramanian S

Marked as answer
Loader.
Up arrow icon