0
I am with a web project that needs to implement functions to generate the content of a table according to the chosen item. For example on my Dashboard I have a tower icon, and below I have a table with all the equipment listed. The question, I have several tower icons on Dashboard and the table are all registered equipment. As you can see below:
Where the patchpanel 100 is linked to tower princess and the other two to tower paradise. Instead, I would like to click on a certain tower to list only the equipment of that tower.
My html Dashboard:
<div class="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 tell 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;
}
but how to generate an id dynamically for each registered tower?
– Carlos Diego
Does the tower have any type id reference? Unique for each tower?
– usuario
yes, a single id for each tower.
– Carlos Diego
may use it or the tower’s own name as long as they do not repeat themselves.
– usuario
but the id is generated by the bank, how to know if the id eh of that tower msm? excuse my ignorance, I am inexperienced, I have not yet managed to abstract logic
– Carlos Diego
For example in your list you use
${p.nome}
to pick up the name of the tower. Right? Could you pick up the tower id with${p.id}
?– usuario
Let’s go continue this discussion in chat.
– usuario