开发者

Autocomplete for textfield in Sencha Touch?

I'm making an flight search app with Sencha Touch and have encountered a small problem.

I want to create a textfield for all the airports 开发者_StackOverflow社区and need autocomplete functionality for in order to make it easy for the user to choose departure airport and return airport. How can i implement this? The airports will be loaded via XML-schema and I can't seem to find any good documentation for this feature.

Thanx in advance!


Since there were no custom components out there and I needed something like this myself as well, I smashed it together.

So, here it is. Sencha Touch 2 Autocomplete Textfield component: https://github.com/martintajur/sencha-touch-2-autocomplete-textfield

It currently uses AJAX request response for populating the autocomplete matches. It also supports custom input by the user.

When serializing the form data, the value of this type of input will be:

  • the selected item ID in case user has selected a matched autocomplete result
  • the typed text when the user has not chosen an autocomplete result

It is very basic at the moment and completely driven by own need for such a control. Feel free to fork, modify, adapt. It's MIT-licenced.


I think you should use a searchfield instead of textfield as suggested by @Ismailp,

Then you should create a popup(a panel) in its keyup event, which should contain a list of Airports.

Go through the hidden folder list-search in the example folder in downloaded sencha framework.It shows how to search through a list.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜