Closed Patrick1701 closed 10 years ago
Hi Patrick,
Thanks for letting me know there could be a usecase for this! I will keep it (actually, I will restore it asap! ;))
Best regards, Sebastien
Thanx a lot!
I'm not sure, if this is the best solution, but currently we will need this method.
I made some code-reviews here in the last 10minutes, and some of our guys uses this quite often. And as more I think about, this is a quite nice feature. AutoCompleteTextfields nature (often, for normal users) is to search on any attribute of the entities the autocomplete textfield provides.
Asking the textrender for a match, is also very clear to the user, because he sees what the system tries to match and the developer doesnt have to implement item.getX().contains(input) || item.getY().contains(input)
etc pepe.
Maybe you could provide this as an feature, as well.
Lets say, you implement a method match(input)
on TextRenderer. It could save its matches and on rendering the choices it shows the matching parts bold.
This is quite brainstormed and not well designed... just an idea.
regards Patrick
Yes, nice idea! Will look at this...
Hi Patrick,
#getRenderer
has been restored and I've added ITextRenderer#match
. Usage is the following:
@Override
protected List<Genre> getChoices(String input)
{
...
for (MyPojo pojo...)
{
if (this.getRenderer().match(pojo, input, false))
{
choices.add(pojo);
}
}
}
Deployed 6.17.1-SNAPSHOT
& 7.0.0-SNAPSHOT
Hi Sebastien, as mentioned in javadoc... I open an issue. :-)
Could you please keep this method for now?
What we are doing here is, loading some more data from our DB as needed for filtering, and do filter later in
getChoices(...)
on the String-Representation provided by the TextRenderer.So, in this case, we are asking AutoCompleteTextfield for
getRenderer()
.I'm not sure, if this is the best solution, but currently we will need this method.
kind regards Patrick