简体   繁体   English

使用ExtJs自动完成文本字段

[英]Auto complete textfield with ExtJs

How can I code a simple auto complete feature with ExtJs? 如何使用ExtJs编写简单的自动完成功能? If the field has address and they start typing st it should become street, etc 如果该字段有地址并且他们开始键入st它应该成为街道等

As Mitch suggests in his comment, you can use Ext.form.Combobox, properly configured, to do this. 正如Mitch在评论中建议的那样,你可以使用正确配置的Ext.form.Combobox来做到这一点。 You won't need to bind anything to the keyup event, as Combobox will handle this for you. 您不需要将任何内容绑定到keyup事件,因为Combobox将为您处理此事。

Here's the beginning of a config that should work. 这是配置应该起作用的开始。 You'll need to provide an appropariate Ext.data.Store (or subclass thereof), along with a few other config values (displayField,valueField,queryParam, etc). 您需要提供一个适当的Ext.data.Store(或其子类),以及一些其他配置值(displayField,valueField,queryParam等)。 All the necessary stuff is pretty well documented in the API docs) 所有必要的东西都在API文档中有详细记录)

MyTypeahead = new Ext.form.ComboBox({
   triggerAction:'all',
   typeAhead:true,
   mode:'remote',
   minChars:2,
   forceSelection:true,
   hideTrigger:true
});

这是他们的例子,他们称之为“ 实时搜索 ”。

ExtJS:如何让组合框执行“包含”/ LIKE搜索看到这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM