I'm having a web project that needs to implement functions to generate the contents of a table according to the chosen item. For example in my dashboard I have a tower icon, and just below I have a table with all the equipment listed. The question, I have several icons of towers in the dashboard and the table are all equipment registered. As you can see below:
Wherethepatchpanel100islinkedtothelittleprincesstowerandtheothertwotheparaisotower.Instead,Iwouldlikeyoutoclickonaparticulartowertolistonlytheequipmentinthattower.
Myhtmldashboard:
<divclass="row">
<input type="hidden" name="torre.id" value="${t?.id}" /> #{list
items:torres, as:'t'}
<div class="col-lg-1 col-sm-1">
<img class="img-circle img-responsive"
src="/public/images/torre-green.svg">
<h5><center>${t.nome}</center></h5>
</div>
#{/list}
<div class="col-lg-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-cubes"></i> Detalhes Patch panels
</h3>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Patch panel</th>
<th>MAC</th>
<th>IP</th>
<th>Status</th>
</tr>
</thead>
<tbody>
#{list items:patch, as:'p'}
<tr>
<td>${p.nome}</td>
<td>${p.mac}</td>
<td>${p.ip}</td>
<td>${p.status}</td>
</tr>
#{/list}
</tbody>
</table>
</div>
</div>
</div>
</div>
When registering a new patchpanel I say which tower it is linked to, so my tower model has a patchpanel list:
@Entity
public class Torre extends Model {
@Required
public String nome;
@Required
public String endereco;
@Required
public String bairro;
@Required
public String cidade;
public String pontoRef;
public String latitude;
public String longitude;
public String altura;
@Required
public String sustentavel;
@OneToMany(mappedBy="torre")
public List<Patchpanel> patchpanels;
@Enumerated(EnumType.STRING)
public Status status;
public Torre() {
status = Status.ATIVO;
}