Rap incubator DropDown/Autosuggest fine tuning [message #1276385] |
Mon, 24 March 2014 13:42 |
|
Hello,
I'm planning to use the AutoSuggest feature from RAP incubator's projects in an application. I thus have a few questions that seem to be unanswered in the forum.
Rap version is 2.2 and Autosuggest is 0.2
1) If I understand correctly, the suggestion list is statically created at instantiation time. Is there any way to dynamically updates the suggestions depending on the context of the current Text control and/or to define a kind of content provider that can manage the filtering part on the server side (typically using requests on a repository) ?
2) I would also like to display some suggestions on "focus in", when the text is blank. Any hint on this?
Many thanks in advance.
Bruno
[Updated on: Mon, 24 March 2014 13:44] Report message to a moderator
|
|
|
Re: Rap incubator DropDown/Autosuggest best practices [message #1276983 is a reply to message #1276385] |
Tue, 25 March 2014 10:03 |
Tim Buschtoens Messages: 396 Registered: July 2009 |
Senior Member |
|
|
Hi.
> 1) If I understand correctly, the suggestion list is statically created
> at instantiation time. Is there any way to dynamically updates the
> suggestions depending on the context of the current Text control and/or
> to define a kind of content provider that can manage the filtering part
> on the server side (typically using requests on a repository) ?
There are various options.
- You can exchange the DataSource of the AutoSuggest at any time. Don't
forget to dispose the old DataSource if you don't need it any more.
- You can set a filter script on the DataSource that uses it's own
logic, though at this time you can not exchange the filter or give it
hints at runtime.
- You can use the DropDown widget instead of AutoSuggest, which gives
you the ability to implement the behavior in any way you like on the
server, but won't allow for auto-complete behavior due to the network
latency.
Example:
http://git.eclipse.org/c/rap/incubator/org.eclipse.rap.incubator.dropdown.git/tree/examples/org.eclipse.rap.addons.dropdown.demo/src/org/eclipse/rap/addons/dropdown/demo/DropDownDemo.java
We also designed the AutoSuggest so that it would be possible to create
any kind of data source that can for example catch and cache the
suggestions as they are needed, but has not been implemented (yet).
> 2) I would also like to display some suggestions on "focus in", when the
> text is blank. Any hint on this?
The DropDown itself has a setVisible method, but it can not be accessed
from outside the AutoSuggest to prevent the developer from calling
setItems on it (which could cause script errors). However, the
AutoSuggest class is designed to be extendable. If you use it as a super
class, the dropDown widget can be accessed.
Example:
public class MyAutoSuggest extends AutoSuggest {
public MyAutoSuggest( Text text ) {
super( text );
}
public void showSuggestions() {
dropDown.show();
}
}
I hope that helps.
Greetings,
Tim
--
Tim Buschtöns
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03801 seconds