-
Bug
-
Resolution: Fixed
-
Normal
-
6.5.3, 6.5.4
-
None
-
and Version 7.0.0-RC
-
None
As declaredat http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zul/ListModels.html#toListSubModel(org.zkoss.zul.ListModel, java.util.Comparator, int),
comparator - used to compare the value typed by user and the value from the model. The first argument is the value typed by user, and the second argument is the value retrieved from the model. It shall return 0 if they matched (i.e., shall be shown).
I tried to filter the model data with "full text matching",and the logs show that CustomerSortComparator works correctly,
But, the chosenbox drop down with empty list.
But if the input value matches the data at the beginning,it will appear in the chosenbox drop down list,
just like the CustomerSortComparator was invoked and ignored!
ListModels.toListSubModel(new ListModelList<String>(dataList, false),new CustomerSortComparator(), 100);
public class CustomerSortComparator implements Comparator<String> { @Override public int compare(String paramT1, String paramT2) { if (StringUtils.isEmpty(paramT1)) { logger.debug("empty not matching " + paramT2); return -1; } boolean matching = paramT2.indexOf(paramT1) >= 0; if (matching) { logger.debug("compare[" + paramT1 + "|" + paramT2 + "]matching"); return 0; } else { return -1; } } }