Sha256: f84b75bb98eb70cfa76578f976898c268822319128993eb8af87ebdc27d17608

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

include('nativeControl.js');

uki.view.declare('uki.more.view.NativeSelect', uki.more.view.NativeControl, function(Base) {
    
    this._createDom = function() {
        this._dom = uki.createElement('select', 'position:absolute;z-index:100;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;');
        this._initClassName();
        this._initFocusable(this._dom);
    };
    
    uki.delegateProp(this, 'name', '_dom');
    uki.delegateProp(this, 'disabled', '_dom');
    uki.delegateProp(this, 'value', '_dom');
    
    this.options = function(val) {
        if (val === undefined) return uki.map(this._dom.getElementsByTagName('option'), function(option) {
            return { value: option.getAttribute('value'), html: option.innerHTML };
        });
                              
        this._dom.innerHTML = '';
        uki.each(val, function(i, option) {
            var node = uki.createElement('option', '', option.text);
            node.value = option.value;
            node.selected = option.selected;
            this._dom.appendChild(node);
        }, this);
    };
    
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uki-1.1.4 frameworks/uki/src/uki-more/more/view/nativeSelect.js
uki-1.1.3 frameworks/uki/src/uki-more/more/view/nativeSelect.js
uki-1.1.2 frameworks/uki/src/uki-more/more/view/nativeSelect.js