-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello, I have a window that contains components listbox, In listbox used for data input. Once completed, the data input and i going to do that on the reset the listbox
but when i click reset button The process has required a long time in about three seconds
How did to faster so that at the time of resetting listbox not long ?
this my code
zul file
<zk><window id="win" width="1200px" border="normal" apply="${Controller},render.InvoiceRenderer" >
<listbox id="listboxDetailEntry" sizedByContent="true" rows="200"
mold="paging" pageSize="10000" height="350px" nonselectableTags=""/></window></zk>
Controller file
public class InvoiceController extends GenericForwardComposer {
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
invRenderer=new InvoiceRenderer();
invRenderer.doAfterCompose(comp);
setListDetailEntry(new ArrayList<Tmp1>());
ListModelList listModel = new ListModelList(getListDetailEntry());
listboxDetailEntry.setModel(listModel);
listboxDetailEntry.setItemRenderer(invRenderer);
listboxDetailEntry.setMultiple(true);
listModel.setSelection(listModel);
}
//for empty value
public void setEmptyRow(){
for(int i=0;i<75;i++){
Tmp1 tmp=new Tmp1();
tmp.setField1(null);
tmp.setField2(null);
getListDetailEntry().add(tmp);
}
//reset listbox with empty value
public void onClick$btnReset(){
setListDetailEntry(new ArrayList<ReportTmp1>());
setEmptyRow();
ListModelList listModel=new ListModelList(getListDetailEntry());
listboxDetailEntry.setModel(listModel);
listboxDetailEntry.setItemRenderer(invRenderer);
listboxDetailEntry.setMultiple(true);
listboxDetailEntry.renderAll();
listboxDetailEntry.setSelectedIndex(0);
}
class Renderer
public class InvoiceRenderer extends GenericForwardComposer implements Serializable,ListitemRenderer<Tmp1>{
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
}
public void render(final Listitem listitem, Tmp1 tmp1, int index)throws Exception {
Tmp1 tmp= tmp1;
final Listcell codeCell = new Listcell();
final Textbox txtCode= new Textbox();
codeCell.appendChild(txtCode);
final Listcell qtyCell = new Listcell();
final Intbox intQty = new Intbox();
qtryCell.appendChild(intQt);
.
.
//about 25cell
listitem.appendChild(codeCell);
listitem.appendChild(qtyCell);
listitem.setSelected(true);
listitem.setValue(tmp);
}
thanks
by resetting i am guessing you want to make you listbox to its original state as you display it when doing first display, as far as i can think you don't need to fetch list model again by calling getListDetailEntry() because i think it is being fetched from DB that is what taking time, if you just want to reset it to original unselected state simply set selected index to 0 or -1.
Asked: 2015-03-17 02:23:57 +0800
Seen: 10 times
Last updated: Mar 18 '15
ZK Listbox Selectitems issue with Set
How to stop a bug from a listbox?
Cannot Change Listbox Header color & Background
Keyboard navigation in listbox
Can not display data in listbox
listbox with nonSelectabletags inplace new listitem
Input invoice using inline listbox
Change color to hover listitem listbox zk7 + Atlantic Theme
Listbox with autopaging causes constant row flickering
zk listbox getItems() returns null for item.getValue() if not scrolled fully