iam getting very frustating problem when i have to show the value from result of createNativeQuery in Hibernate,my code is like this:
public List<Rmerchant> getListMerchantbyMasterMerchanttest(){
List<Rmerchant> lstMerchant=em.createNativeQuery("select merchant_name,merchant_email,merchant_status from rmerchant where master_merchant_id=123")
.getResultList();
return lstMerchant;
}
this is the simpe query because in advance i have to create more complex query like using count,and many function in query,and my code in ZK zul page like this:
<?xml version="1.0" encoding="UTF-8"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="./test"?>
<?init class="com.nsia.doku.escrow.controller.testController"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="test" xmlns:n="native" title="test" border="normal" position="center" apply="com.nsia.doku.escrow.controller.testController">
<listbox model="@{test$composer.lstMerchant}"
vflex="true">
<auxhead>
<auxheader colspan="3" class="topic">EDS Status</auxheader>
</auxhead>
<listhead>
<listheader label="Merchant Name" align="center"/>
<listheader label="merchant email" align="center" />
<listheader label="merchant status" align="center" />
</listhead>
<listitem self="@{each=lstMerchant}">
<listcell label='@[lstMerchant}' />
<listcell label='@{lstMerchant}' />
<listcell label='@{lstMerchant}' />
</listitem>
</listbox>
</window>
</zk>
if the value is like what i write,the listcell will be like this:
merchant name merchant email
[merch001, jhjhjh, null] [merch001, jhjhjh, null]
[fahmi0090908789788, fahmi@gmail.com, null] [fahmi0090908789788, fahmi@gmail.com, null]
if the code i change in listitem like this:
<listitem self="@{each=lstMerchant}">
<listcell label='@[lstMerchant[0]}' />
<listcell label='@{lstMerchant[1]}' />
<listcell label='@{lstMerchant[2]}' />
</listitem>
or
<listitem self="@{each=lstMerchant}">
<listcell label='@[lstMerchant["0"]}' />
<listcell label='@{lstMerchant["1"]}' />
<listcell label='@{lstMerchant["2"]}' />
</listitem>
or
<listitem self="@{each=lstMerchant}">
<listcell label='@[lstMerchant["merchant_name"]}' />
<listcell label='@{lstMerchant["merchant_email"]}' />
<listcell label='@{lstMerchant["merchant_status"]}' />
</listitem>
or
every lstMerchant i change with each
is not working,aka the listitem show to row but the value is null,,iam so confuse about this problem,maybe somebody can help me?
i used to create web using icefaces,if in icefaces,i just have to place this tag in cell:
currentRow[0] but in Zk,i havent found it..
im sorry for my bad english and this newbie question..thanks..:D
ok as i promise,the thing only i have to do is implements ListitemRenderer,and add the code like this to method render:
the index is based on your column in your nativequery..
and in .zul page you only have to do this:
itemRenderertag add default valueitemRendererand themodelis list based on your controller..thanks for all of your response and sorry for my bad english..thanks..