0

How to put Chosenbox with contains() method?

asked 2022-12-20 20:10:39 +0800

softteam gravatar image softteam
130 1 8

updated 2022-12-20 20:17:45 +0800

Hello,

We are using the chosenbox component with ListModelList(Rendering All) and when we filter we see that the filter uses the startsWith() method

Is there a way to change this method from startsWith() method to contains() method?

Thank you!

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-12-22 11:12:17 +0800

MDuchemin gravatar image MDuchemin
2295 1 6
ZK Team

Hey there,

Simplest option for this is to use

https://www.zkoss.org/javadoc/latest/zk/org/zkoss/zul/ListModels.html#toListSubModel-org.zkoss.zul.ListModel-java.util.Comparator-int-

ListModels#toListSubModel(ListModel<t> model, java.util.Comparator<t> comparator, int nRows)

The comparator has 2 arguments: the input string, and the model data object. When the user searches by entering text, the comparator is invoked on each data object in model. The comparator returns an integer. If you return 0, it means a match, so the item is shown in results. If you return "not zero", it means "not match", so the item is not shown in results

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2022-12-20 20:10:39 +0800

Seen: 5 times

Last updated: Dec 22 '22

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More