You need to close the other ones with close in the onopen event
chillworld ( 2016-01-09 13:35:50 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
We are developing dynamic groupbox by using model list, we have getting groupbox header multiple,but when i click on groupbox,then show all groupbox values : please go through below code :
<div children="@load(vm.expensesforApprovalProcess)" >
<template name="children" var="each">
<groupbox width="100%" mold="3d" closable="false" open="true">
<caption sclass="caption_new" onClick="@command('showApprovalRequestDetails',requestID = each.processID)">
<div class="col-md-6 col-sm-6 padd0">
<div class="form-horizontal mrg_top10">
<div class="form-group marg0">
<h:label class="col-md-3 col-sm-4 col-xs-4 padd_l0">Date of Expense </h:label>
<div class="col-md-9 col-sm-8 col-xs-8">
<label class="padd0" value="@load(each.createdDate)"></label>
</div>
</div>
<div class="form-group marg0">
<h:label class="col-md-3 col-sm-4 col-xs-4 padd_l0">View voucher: </h:label>
<div class="col-md-9 col-sm-8 col-xs-8">
<a href="">
<image src="../css/images/view_attachment.png" onClick="@command('ExpanseReport',expense = each)" visible="@bind(each.isshowVoucher)"/>
</a>
</div>
</div>
</div>
</div>
</caption>
<div class="form-horizontal master_group master_group_first mrg_top10" children="@load(vm.expensesforApproval)" >
<template name="children" var="each">
<div class="form-group col-md-4">
<h:label class="col-md-6 col-xs-6">Employee Code </h:label>
<div class="col-md-6 col-xs-6">
<label value="@load(each.edp_no)"></label>
</div>
</div>
<div class="form-group col-md-4">
<h:label class="col-md-6 col-xs-6">Employee Name: </h:label>
<div class="col-md-6 col-xs-6">
<label value="@load(each.empName)"></label>
</div>
</div>
<div class="form-group col-md-4">
<h:label class="col-md-6 col-xs-6">Status: </h:label>
<div class="col-md-6 col-xs-6">
<label value="@bind(each.status)"></label>
</div>
</div>
<div class="clearboth"></div>
</template>
</div>
<div class="clearboth"></div>
</groupbox>
</template>
Please Help me!.
I think I have found your problem.
First you iterate over a collection to show multiple groupboxes.
Secondly you make a template in each groupbox for the values of the groupbox :
children="@load(vm.expensesforApproval)"
But this collection is the same for every groupbox. You need to make a separation for it and it's possible by :
children="@load(vm.getExpensesforApproval(each.processID))"
so the getter is now :
public ListModel getExpensesforApproval(Integer id) {
return new ListModelList(filterCollectionOnId(id));
}
In the zul, add this to the groupbox :
onOpen="@command('open')"
and the java code :
@Command
public void open(@ContextParam(ContextType.TRIGGER_EVENT) OpenEvent evt) {
Groupbox box = (Groupbox)evt.getTarget();
for (Component comp : box.getParent().getChildren()) {
if (comp instanceof Groupbox) {
((Groupbox)comp).setOpen(false);
}
}
box.setOpen(evt.isOpen());
}
This should do what you want.
Greetz chill.
You need to close the other ones with close in the onopen event
chillworld ( 2016-01-09 13:35:50 +0800 )editAsked: 2016-01-06 13:12:28 +0800
Seen: 23 times
Last updated: Jan 11 '16
Hello sathishk. Could you give some more information regarding your issue?
Darksu ( 2016-01-07 11:38:39 +0800 )editDear Darksu , we have using dynamic groupbox,suppose we have two groupbox having multiple records,when i click on one groupbox then open clicked groupbox withed records,but when i click on particular groupbox shows all groupbox information,kindly check above code.
sathishk ( 2016-01-07 12:05:16 +0800 )edityour var in the 2 template are called each, but they nest each other. Please use unique keywords in a scope.
chillworld ( 2016-01-07 12:52:02 +0800 )editDear chillworld,thank you for respnse.we have added different var declaration;first temple given as var=each and next one as var=each1.But same issue showing.
sathishk ( 2016-01-07 16:04:36 +0800 )editI can't follow it completely, is it possible to recreate the issue in zk fiddle or post some screenshots with the issue? (Personally I prefer a zk fiddle)
chillworld ( 2016-01-07 19:15:10 +0800 )edit