sebfz1 / wicket-jquery-ui

jQuery UI & Kendo UI integration in Wicket
http://www.7thweb.net/wicket-jquery-ui/
Other
93 stars 58 forks source link

AutoCompleteTextfield / getRenderer() / "Open an issue in GitHub if you need it" #126

Closed Patrick1701 closed 10 years ago

Patrick1701 commented 10 years ago

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

/**
* Gets the {@link ITextRenderer}
*
* @return the {@link ITextRenderer}
* @deprecated probably useless, will be removed. Open an issue in GitHub if you need it
*/
@Deprecated
public ITextRenderer<? super T> getRenderer()
{
return this.renderer;
}
sebfz1 commented 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

Patrick1701 commented 10 years ago

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

sebfz1 commented 10 years ago

Yes, nice idea! Will look at this...

sebfz1 commented 10 years ago

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);
        }
    }
}
sebfz1 commented 10 years ago

Deployed 6.17.1-SNAPSHOT & 7.0.0-SNAPSHOT