I am really lost as to which widget I need in order to implement the following use case. (Alternatively, could I adapt an existing widget?)
Here's the setup. I have a large list of regions. Here's part of it:
[
{id:1, name:"Canada"},
{id:2, name:"France"},
{id:3, name:"United Kingdom"},
{id:4, name:"United States of America"}
]
The form displays what looks like a text field. As soon as the user starts typing, a drop-down list of suggestions should appear. The user selects a result with the cursors or the mouse. The result is constrained to be one from the list. So far, it sound like a FilteringSelect, doesn't it? Please read on...
I have a QueryService that, given a partial query typed by the user, can provide a filtered sublist of the original list. (The service is called after each keystroke in order to update the list.) So far, that's a standard situation. For instance, QueryService?query=uni would yield the following sublist:
[
{id:3, name:"United Kingdom"},
{id:4, name:"United States of America"}
]
But here's the twist... The QueryService is clever and can deduce that QueryService?query=england should yield:
[
{id:3, name:"United Kingdom"}
]
or again, QueryService?query=usa should yield:
[
{id:4, name:"United States of America"}
]In short, this entails that the filtered sublist is likely to include items whose name does not contain the string typed by the user.
Finally, on submit, the form must return the id integer and not the name string.
Can a widget cope with that use case?
