combo

class webix.ui.combo(data)
Arguments:
  • data (object) – A configuration object

Combo view.

References

views
richselect().
helpers
isUndefined(), protoUI().

External references

Official documentation page.

Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
webix.protoUI({
    name:"combo",
    getInputNode:function(){
        return this._dataobj.getElementsByTagName('input')[0];
    },
    $render:function(obj){
        if (webix.isUndefined(obj.value)) return;
        this.$setValue(obj.value);
    },
    _revertValue:function(){
        if(!this._settings.editable){
            value = this.getValue();
            this.$setValue(webix.isUndefined(value)?"":value);
        }
    },
    _applyChanges:function(){
        var input = this.getInputNode(),
            value = "",
            suggest =  this.getPopup();

        if (input.value){
            value = this._settings.value;
            if(suggest.getItemText(value) != this.getText())
                value = suggest.getSuggestion()||value;
        }
        if (value != this._settings.value)
            this.setValue(value, true);
        else
            this.$setValue(value);
    },
    defaults:{
        template:function(config, common){
            return common.$renderInput(config).replace(/(<input)\s*(?=\w)/, "$1"+" role='combobox'");
        },
        icon: "angle-down"
    }
}, webix.ui.richselect);