It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

how do i loop Soy templates with data as array passed to template

Gopi Krishnam Raju Jun 13, 2016

Js code

exampleArray = [project1,project2];

var templateproject = JIRA.Templates.LP.project(exampleArray);

AJS.$('#page-container').append(templateproject);

 

soy template

{namespace JIRA.Templates.LP}
{template .project}
<table class="aui">
<thead>
<th>Project Title</th>
</thead>
<tbody>
{foreach $key in keys($exampleArray)}
<tr>
<td>{$exampleArray[$key]}</td>
</tr>
{/foreach}
</tbody>
</table>
{/template}

 

Is this correct way of looping soy template when passing array as data.

 

 

 

1 answer

2 votes
Petar Petrov Jun 13, 2016

You can also do:

{foreach $project in $exampleArray}
&lt;tr&gt;
&lt;td&gt;{$project}&lt;/td&gt;
&lt;/tr&gt;
{/foreach}

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

736 views 7 0
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you