ZK Bandbox Listbox自动老化问题与过滤



我有一个使用ZK 5.0.8(M.V.C方法)的bandBox,里面是一个列表框,显示记录,稍后在bandBox eventListener[event]中过滤onChanging的结果,但有时pageSize和分页与列表框上的结果不同步,有时不是IT上的记录(0匹配),仍然显示

 1/ 13[ 1 - 4 / 51]

为什么??谁能给我点提示吗?以下是我的相关代码

<bandbox id="bandforcode" autodrop="true" width="270px">    
<listbox id="listBoxForCode" height="250px" width="300px" mold="paging" autopaging="true">
 public void setListBoxForBandBoxFromDB(Listbox box,String ref)//Filtering
 {     
   final ArrayList<Student>students = new ArrayList<Student>(manager.getListForStudentsByRefBandBox(ref));     
   box.getItems().removeAll(box.getItems());       
   BindingListModelList model = new BindingListModelList(students,false);
   box.setModel(model);
}
box.addEventListener("onChanging",new EventListener()//Listener
{
    public void onEvent(Event event) throws Exception
    {                       
    final Bandbox band = (Bandbox)event.getTarget();
    final org.zkoss.zk.ui.event.InputEvent inputEvent=(org.zkoss.zk.ui.event.InputEvent)event;              
    final String initialText = inputEvent.getValue();                                  
setListBoxForBandBoxFromDB((Listbox)band.getFirstChild().getFirstChild(),initialText);                          
     }
});         

请看下面的图片。

截图

我想问题可能出在这里

box.getItems().removeAll(box.getItems()); 

使用Model时不能编辑Items

改为

box.getModel().clear(); 

或者直接删除行,因为你已经设置了一个新模型

最新更新