第二部分: Dijit 2.1 自动完成部件(Autocompletor) 。。。

AutoCompleter.png

自动完成部件是一个下拉选择框和文本框的混合体。象选择框的地方是你提供了一个数据列表,不象选择框而象文本框的地方是用户可以忽略所有的选择而输入他想要的内容。这对开放性的多重选择问题非常的方便。但这不是2个控件,你只能使用其中的一个。

注意选择框总是有(值/描述),例如:option的值和option体的文字。自动完成控不是这样,他们仅传递显示的值,就象文本框一样。

例子

第一眼看上去,美国州的自动完成部件并不比一个下拉选择框复杂。

  
  
< script  type ="text/javascript" >
    dojo.require(
"dijit.form.AutoCompleter");
    dojo.require(
"dijit.util.parser");
</ script >
...
< select  id ="setvaluetest"  name ="state"  dojoType ="dijit.form.AutoCompleter"  
        class
="myComboBox"  searchField ="name"  autocomplete ="false"  value ="Iowa"
>
    
< option  value ="Alabama" > Alabama </ option >
    
< option  value ="Alaska" > Alaska </ option >
        ...
</ select >

Write an example for data provider-fed auto completer. Details are a little fuzzy at the moment, and the unit tests are not fully constructed.  

Dijit Types, Attributes, Events and Methods

dijit.AutoCompleter
Auto-completing text box, and base class for Select widget. The drop down box's values are populated from an class called a data provider, which returns a list of values based on the characters that the user has typed into the input box.
Attributes
autoCompleteBooleantrueIf true, on losing focus, automatically copy the first entry displayed in the drop down list to the input field.
searchFieldStringnameSearches pattern match against this field. Am not sure what this means
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值