-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I am creating a listbox using zul and composer.
my zul file contains
<listbox id="vendorGridId" vflex="true" selectedItem="@{vendorProfilesId$composer.selected}">
<listhead>
<listheader label="Company Name" sort="auto(companyName)" />
<listheader label="Vendor #" sort="auto(vendorNumber)" />
<listheader label="Status" sort="auto(status)" />
<listheader label="Address"/>
<listheader label="City"/>
<listheader label="State"/>
<listheader label="Zip"/>
</listhead>
</listbox>
code to draw listbox.
my composer file contains
public void doAfterCompose(org.zkoss.zk.ui.Component component) throws Exception {
super.doAfterCompose(component);
vendorGridId.setItemRenderer(new ListitemRenderer() {
@Override
public void render(Listitem item, Object data) throws Exception {
VendorProfileBean vendorProfileBean = (VendorProfileBean) data;
Listcell lc1 = new Listcell(vendorProfileBean.getCompanyName());
Listcell lc2 = new Listcell(vendorProfileBean.getVendorNumber().toString());
Listcell lc3 = null;
if(vendorProfileBean.getStatus() == 1){
lc3 = new Listcell("Active");
}else{
lc3 = new Listcell("Inactive");
}
Listcell lc4 = new Listcell(vendorProfileBean.getBillAddress1());
Listcell lc5 = new Listcell(vendorProfileBean.getBillCity());
Listcell lc6 = new Listcell(vendorProfileBean.getBillStateCode());
Listcell lc7 = new Listcell(vendorProfileBean.getBillZipCode());
lc1.setParent(item);
lc2.setParent(item);
lc3.setParent(item);
lc4.setParent(item);
lc5.setParent(item);
lc6.setParent(item);
lc7.setParent(item);
item.setAttribute("data", data);
}
});
pagingId.setPageSize(_pageSize);
refreshModel(pagingId.getActivePage(), true);
}
private void refreshModel(int activePage, boolean updateTotalSize){
PagingListModel model = (PagingListModel)vendorGridId.getListModel();
if(model == null){
model = new PagingListModel(activePage, _pageSize, this);
vendorGridId.setModel(model);
}
if (updateTotalSize) {
pagingId.setTotalSize(model.getTotalSize());
}
}
when i am clicking first time on menu to draw list box, it is drawing list with sells data . but when i am clicking on second time
on menu then it is displaying blank grid.
I debuged .I found that my vendorGridId.setItemRenderer() method as above is executing each time and setting data into cell.
When i saw in firebug on each click on menu, first time cells data is showing in firebug but not second time.
How can i resolved this issue.
Thanks
Vivek
Asked: 2011-05-17 07:14:18 +0800
Seen: 427 times
Last updated: May 17 '11