如何实现Dojo自动完成类似于jQuery UI自动完成?

问题描述:

好的一天,使用JSP和jQuery UI我已经成功实现了文本输入的自动完成。自动完成数据从数据库检索,并通过服务器端的q参数进行过滤。它返回包含查询字符串的所有项目:

Good day, using JSP and jQuery UI I have successfuly implemented autocompletion for a text input. Autocomplete data are retrieved from a database and filtered by 'q' parameter on the server side. It returns all items containing queried string:

SELECT name FROM organization WHERE name LIKE '%q%';

有没有办法与Dojo做同样的事情?我遵循了 Dojo教程,但是当我输入示例信函 a 到文本输入文本输入中的文本get被替换为第一个建议 Ibam 和我的第一个字母 a 被替换为 I 从单词 Ibam 。它很奇怪请指教。

Is there a way how to do the same with Dojo? I followed this Dojo tutorial , but when I type for example letter a into the text input the text in the text input get's replaced by first suggestion Ibam and my first letter a is replaced with I from word Ibam. It works strange. Please advise.

Vojtech

我会推荐 dijit / form / ComboBox dojo / store / JsonRest

I would recommend dijit/form/ComboBox with dojo/store/JsonRest.

看到它有效: http:// jsfiddle。 net / phusick / N8DqG /