Wednesday, November 21, 2012

Re: gwt suggestbox.

Hi, sorry for re-opening a topic from 2009.

In the above code, you said nameCallback = callBack, where is this nameCallback being used?
I don't quite understand how to use the callback.

I was just wondering if there's a full implementation / example available on how to extend the SuggestOracle using RPC.

public class MySuggestOracle extends SuggestOracle {

    @Override

    public void requestSuggestions(Request request, Callback callback) {

    }

}


// in my ManageSomePageView.java

TextBox textBox = new TextBox();

horizontalPanel.add(new SuggestBox(new MySuggestOracle(), textBox));



Thanks
Jan



On Thursday, 29 October 2009 23:11:22 UTC+2, mdwarne wrote:
I don't know if this helps, but I wrote a PersonSugggestOracle that
extends SuggestOracle

The method below calls the server.  It doesn't call the server if
there are not at least 2 characters typed.

On the server side, I have a sql query that uses the characters to
perform a 'like' comparison on the first name, or the lastname so it
works similar to like a multiword suggest oracle.
On the server, I return the Person Name as a small HTML string with
<b></b> tags surround the characters that the user typed to emphasize
the part of the first or last name that is matching. I also limit the
response to 12 matching records on the server.

 @Override
    public void requestSuggestions(Request request, Callback callback)
{
            nameCallback = callback;
            String q = request.getQuery();
            if (q >=2) {
                   asyncRequest.personSuggest(q,submitterId,12,new PersonsReceived
(request));
            }
    }

Mike.

On Oct 29, 3:47 am, Isaac Truett <itru...@gmail.com> wrote:
> As Thomas said, you'll need to write a SuggestOracle that returns an
> empty list of suggestions for queries shorter than x characters. And I
> wanted to add: if you want to keep the functionality of the
> MultiWordSuggestOracle then you can have your oracle delegate to a
> MuliWordSuggestOracle instance for queries that are long enough. As I
> recall MultiWordSuggestOracle is not amenable to subclassing, and
> composition is a better strategy anyway.
>
>
>
> On Thu, Oct 29, 2009 at 5:27 AM, Thomas Broyer <t.bro...@gmail.com> wrote:
>
> > On 28 oct, 21:46, kss <kunjals...@gmail.com> wrote:
> >> I am using the gwt suggestbox currently as a typeahead text box to
> >> display suggestions from MultiSuggestOracle. Now I need a way to
> >> enable the suggestbox to appear only after a fixed set of characters
> >> are entered in the text box. Is there a way to do this ? Any
> >> suggestions.
>
> > Have your SuggestOracle return an empty response until the query is
> > "long enough" ?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/tCW1uIM1IFgJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment