Revision history [back]

click to hide/show revision 1
initial version

asked 2014-12-16 06:17:12 +0800

syeligeti gravatar image syeligeti

populate list when clicking on other grid row cell button

Hi,

I am new to ZK framework. I have two grids in same zul file. When ever i click on first grid row cell button then i need to populate other grid.

For this i have written viewmodel, when ever i click on button am calling viewmodel notifyChange event and written business logic to get details of list to populate other grid. But the list of object while accessing in zul file am not able to get value.

zul file

first grid contains button in row

<window apply="org.zkoss.bind.BindComposer" viewmodel="@id('vm') @init('com.hm.controller.CountryViewModel')"> <listbox vflex="true" hflex="1" model="@load(vm.countryData.countries)"> <auxhead> <auxheader colspan="6" class="topic">Country List</auxheader> </auxhead> <listhead> <listheader label="Country Name" align="center"/> <listheader label="Country Code" align="center"/> </listhead> <template name="model" var="country"> <listitem> <listcell> <hbox> <button label="@load(country.countryName)" onclick="@command('countryDetails', countryId=country.countryId)"/> </hbox> </listcell>
<listcell label="@load(country.code)"/> </listitem> </template> </listbox>

viewmodel business logic

@Command @NotifyChange("countryDetails") public List<state> countryDetails(@BindingParam("countryId") int countryId) { List<state> states = new CountryDaoImpl().getStates(countryId); return states; }

second grid in same zul file

<grid model="${states}" emptymessage="Nothing in Domain" height="400px"> <columns sclass="tableDataHeading"> <column label="state Name" sclass="w10"/> <column label="code" sclass="w20"/> </columns> <template name="model" var="state"> <row> <label value="${state.stateName}"/> <label value="${state.code}"/> </row> </template> </grid>

Please suggest me on this.

Thanks, Sreedhar

populate list when clicking on other grid row cell button

Hi,

I am new to ZK framework. I have two grids in same zul file. When ever i click on first grid row cell button then i need to populate other grid.

grid. For this i have written viewmodel, when ever i click on button am calling viewmodel notifyChange event and written business logic to get details of list to populate other grid. But the list of object while accessing in zul file am not able to get value.

value. zul file

file first grid contains button in row

row ------------------ <window apply="org.zkoss.bind.BindComposer" viewmodel="@id('vm') viewModel="@id('vm') @init('com.hm.controller.CountryViewModel')"> <listbox vflex="true" hflex="1" model="@load(vm.countryData.countries)"> <auxhead> <auxheader colspan="6" class="topic">Country List</auxheader> </auxhead> <listhead> <listheader label="Country Name" align="center"/> align="center" /> <listheader label="Country Code" align="center"/> align="center" /> </listhead> <template name="model" var="country"> <listitem> <listcell> <hbox> <button label="@load(country.countryName)" onclick="@command('countryDetails', onClick="@command('countryDetails', countryId=country.countryId)"/> </hbox> </listcell>
<listcell label="@load(country.code)"/> label="@load(country.code)" /> </listitem> </template> </listbox>

</listbox> viewmodel business logic

logic ---------------------------- @Command @NotifyChange("countryDetails") public List<state> List<State> countryDetails(@BindingParam("countryId") int countryId) { List<state> List<State> states = new CountryDaoImpl().getStates(countryId); return states; }

} second grid in same zul file

file --------------------- <grid model="${states}" emptymessage="Nothing emptyMessage="Nothing in Domain" height="400px"> <columns sclass="tableDataHeading"> <column label="state Name" sclass="w10"/> <column label="code" sclass="w20"/> </columns> <template name="model" var="state"> <row> <label value="${state.stateName}"/> <label value="${state.code}"/> </row> </template> </grid>

</grid> Please suggest me on this.

this. Thanks, Sreedhar

Sreedhar
Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More