仅当用户至少键入 3 个字符时,我才想搜索我的树。我如何捕捉“doSelect”事件来做到这一点?如果我在文本字段上添加一个 keylistener 来检查它的值,则在 doSelect 之后调用处理程序。谁能帮我?
这是一个例子...
filterText = new StoreFilterField<ModelData>() {
@Override
protected boolean doSelect(Store<ModelData> store,
ModelData parent, ModelData record, String property,
String filter) {
String name = record.get("name");
name = name.toLowerCase();
if (name.startsWith(filter.toLowerCase()))
return true;
else
return false;
}
};
KeyListener keyListener = new KeyListener() {
public void componentKeyUp(ComponentEvent event) {
loadingImage.setVisible(false);
if(filterText.isValid() && filterText.getRawValue().length()>=FILTER_MIN_SIZE) {
filterText.bind(store);
} else {
filterText.unbind(store);
}
}
};
filterText.setMinLength(FILTER_MIN_SIZE);
filterText.bind(store);