Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / form / MultiComboBox.js @ 12

History | View | Annotate | Download (1.49 KB)

1
/*
2
        Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3
        Available via Academic Free License >= 2.1 OR the modified BSD license.
4
        see: http://dojotoolkit.org/license for details
5
*/
6

    
7

    
8
if(!dojo._hasResource["dojox.form.MultiComboBox"]){
9
dojo._hasResource["dojox.form.MultiComboBox"]=true;
10
dojo.provide("dojox.form.MultiComboBox");
11
dojo.experimental("dojox.form.MultiComboBox");
12
dojo.require("dijit.form.ComboBox");
13
dojo.require("dijit.form.ValidationTextBox");
14
dojo.declare("dojox.form.MultiComboBox",[dijit.form.ValidationTextBox,dijit.form.ComboBoxMixin],{delimiter:",",_previousMatches:false,_setValueAttr:function(_1){
15
if(this.delimiter&&_1.length!=0){
16
_1=_1+this.delimiter+" ";
17
arguments[0]=this._addPreviousMatches(_1);
18
}
19
this.inherited(arguments);
20
},_addPreviousMatches:function(_2){
21
if(this._previousMatches){
22
if(!_2.match(new RegExp("^"+this._previousMatches))){
23
_2=this._previousMatches+_2;
24
}
25
_2=this._cleanupDelimiters(_2);
26
}
27
return _2;
28
},_cleanupDelimiters:function(_3){
29
if(this.delimiter){
30
_3=_3.replace(new RegExp("  +")," ");
31
_3=_3.replace(new RegExp("^ *"+this.delimiter+"* *"),"");
32
_3=_3.replace(new RegExp(this.delimiter+" *"+this.delimiter),this.delimiter);
33
}
34
return _3;
35
},_autoCompleteText:function(_4){
36
arguments[0]=this._addPreviousMatches(_4);
37
this.inherited(arguments);
38
},_startSearch:function(_5){
39
_5=this._cleanupDelimiters(_5);
40
var re=new RegExp("^.*"+this.delimiter+" *");
41
if((this._previousMatches=_5.match(re))){
42
arguments[0]=_5.replace(re,"");
43
}
44
this.inherited(arguments);
45
}});
46
}