Closed Patrick1701 closed 3 years ago
Hi Patrick,
I set serverFiltering=true
by detault. The #getChoice
method has its signature changed as well.
Your usage might be something like this:
final MultiSelect<String> multiselect = new MultiSelect<String>("select", Model.ofList(selected)) {
private static final long serialVersionUID = 1L;
@Override
public void onConfigure(JQueryBehavior behavior)
{
super.onConfigure(behavior);
behavior.setOption("minLength", 2);
behavior.setOption("enforceMinLength", true);
// If set to true the widget will not show all items when the text of the search input cleared.
// By default the widget shows all items when the text of the search input is cleared. Works in conjunction with minLength.
}
@Override
protected List<String> getChoices(String input)
{
// Even with enforceMinLength=true, the widget may send an empty request (on remove-focus for instance)
if (!Strings.isEmpty(input))
{
return ListUtils.startsWith(input, GENRES); // lookup in your DAO, etc...
}
return Collections.emptyList();
}
}
If you have other MultiSelect
you don't want to have the serverFiltering=true
, you can do like this:
final AjaxMultiSelect<String> multiselect = new AjaxMultiSelect<String>("select", Model.ofList(selected)) {
private static final long serialVersionUID = 1L;
@Override
protected void onConfigure(KendoDataSource dataSource)
{
super.onConfigure(dataSource);
dataSource.set("serverFiltering", false); // default is true
}
@Override
protected List<String> getChoices(String input)
{
// note: 'input' is always empty when serverFiltering=false
return myChoices;
}
}
I deployed 8.12.1-SNAPSHOT
and 9.3.3-SNAPSHOT
.
Please give it a try and I will release next week-end.
@sebfz1 Sorry, for replying late. I will have a test. Unfortunately, currently I'm not able to connect sonatype to get the snapshot, caused by company network restrictions. I try to find a solution, and will give feedback.
Patrick
Maybe you can checkout the repo and build locally (just for testing purpose)?
@sebfz1 I tried, but where do I find the branch for 8.12.1-SNAPSHOT?
I committed on wicket8.x branch
@sebfz1 Ah, the open 8.x branch is at 8.12.1-SNAPSHOT... ok, I see. Sorry.
@sebfz1 It seems the case-sensitiv filtering is not working. I always get a lower-case input String.
@sebfz1 I think it works quite good, except the lower-case issue which is not a huge problem to us. If you like you can create a release.
8.12.x is fine, 8.10.x would be great.
regards Patrick
Hi Sebastien, we have a quite custom version of a multiselect, I would like to get rid off.
A key feature is missing at the current impls of your KendoUI MultiSelects. Filtering the choices by input, like for autocomplete text fields, to be able to fetch them from a database, containing a huge amount of possible choice-values.
As far as I can see, the Lazy Multiselect seems to be best candidate for, because it already provides a datasource with a transport read callback to the server. Could you provide a version with a filter feature like the kendoUI autocomplete.
thanx a lot Patrick