Issue with iterating HashMap in table DOM

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Issue with iterating HashMap in table DOM

aliveoceans
Hi, I need some for iterating HashMap to make html table.. here is my class and Map structure..
class Sample { private Sample parentSample; ...}

Map<Sample, List<Sample>> parentChildMap = new ...

parentChildMap  is grouping of childs and having common parent element for each child group.

< table data-th-if="${parentChildMap  != null && not parentChildMap.isEmpty()}">
                                <thead>
                                        <tr>// some headers</tr>
                                </thead>
                                <tbody>
<!-- Iterating map  -->
<tr  data-th-each="parentEntry : ${parentChildMap}" class="active"> //<td> with extracting value from parent (parentEntry .key) </tr>
<!-- Iterating child elements -->
<tr  data-th-each="child : ${parentEntry.value}"  class="passive"> //<td> with extracting parent (key) </tr>
</tbody>
...

What I am trying to achieve is to shoe=w parent row highlighted and child rows in passive look.

The problem here is that the scope of "parentEntry : ${parentChildMap}" in first TR element is till that TR only. the value "child : ${parentEntry.value}" beyond  TR scope is inaccessible for child rows.

So how to achieve this kind of structures..

pleas help, I need this in urgent because of project deadline.. :(