Project

General

Profile

Server-side-only suggestions: can it be done with a WSuggestionPopup?

Added by Peter K over 13 years ago

Hi,

I'd like to provide suggestions when a user inputs text into a WLineEdit. However, my dataset is quite large and the suggestions have to come from the server. The end effect should be like what every major search engine does: the user types a new letter and the server updates the suggestion window.

I have tried to use WSuggestionPopup but so far unsuccessfully. I tried connecting to a keyWentUp event for the WLineEdit and updating the suggestions that way, but the problem is that client-side matching occurs before the update of suggestions... I also tried setting setFilterLength(1) and reacting to filterModel events, which works but only for the first letter...

Is there some other way that I could implement this using a WSuggestionPopup?

Regards,

Peter


Replies (4)

RE: Server-side-only suggestions: can it be done with a WSuggestionPopup? - Added by Koen Deforche over 13 years ago

Hey Peter,

the examples/feature/suggestionpopup has a serverSideFilteringPopup() which illustrates how you can do this ?

Regards,

koen

RE: Server-side-only suggestions: can it be done with a WSuggestionPopup? - Added by Peter K over 13 years ago

Thanks Koen, I understand how this example works but it does not help me, unfortunately.

Here is the issue: I would like to filter suggestions server-side after every letter the user types, and have "WSuggestionPopup::Editing" as my popup trigger. However, when using the "Editing" trigger, the "filterModel" signal is issued ONLY ONCE - after the user types "filterLength()" symbols. That does not work for me, as I need to filter the model after every symbol typed.

By the way, when the trigger is set to "WSuggestionPopup::DropDownIcon", the "filterModel()" signal is issued after every symbol up to filterLength() and everything works well. But in that case the suggestions are not shown automatically when the user starts typing.

So I was wondering, can we get a feature where for some filterLength (say, for filterLength()==--1 ) the filterModel() signal is issued after every letter typed, even in the "Editing" trigger mode? Or is there some other workaround?

With regards,

Peter

RE: Server-side-only suggestions: can it be done with a WSuggestionPopup? - Added by Koen Deforche over 13 years ago

Hey Peter,

Aha. I see, indeed some flexibility is missing in the API... I've created a feature request for this:

http://redmine.emweb.be/issues/933

Regards,

koen

RE: Server-side-only suggestions: can it be done with a WSuggestionPopup? - Added by Peter K over 13 years ago

Thanks! For now, I was able to get the required behavior by messing with WSuggestionPopup.js, but it's not a particularly good solution.

Peter

    (1-4/4)