I'm trying to compare two lists by using only scala templates from play framework. My goal is to show all items listA in a table and then find out if listA has objects containing the same values as in listB to change the appearence of the duplicated items.
So let's assume a.id has an equivalent b.id, then i want a.id to appear in the list but crossed-out.
This is what i got so far:
<tbody>
@for(a <- aList){
@for(b <- bList){
<thead>
<tr>
<th>Key</th>
<th>Name</th>
</tr>
</thead>
@if(a.id == b.id){
<tr>
<td><s>@a.id</s></td>
<td><s>@a.name</s></td>
</tr>
} else {
<tr>
<td>@b.id</td>
<td>@b.id</td>
</tr>
}
}
} </tbody>
So far the code works, but now every element from listA appears as many times as the second loop goes through, which absolutely makes sense, but how can i prevent that?
Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire