Mercurial > lada > lada-client
view app/view/widget/base/ComboBox.js @ 617:ab48824713e2 openid
Merge branch default into openid
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 13 Mar 2015 15:00:55 +0100 |
parents | d47ee7439f44 |
children | fead63bb5fb4 |
line wrap: on
line source
/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz * Software engineering by Intevation GmbH * * This file is Free Software under the GNU GPL (v>=3) * and comes with ABSOLUTELY NO WARRANTY! Check out * the documentation coming with IMIS-Labordaten-Application for details. */ Ext.define('Lada.view.widget.base.ComboBox', { extend: 'Ext.form.Panel', alias: 'widget.cbox', layout: 'hbox', border: 0, margin: '0, 0, 5, 0', initComponent: function() { this.items = [{ xtype: 'combobox', flex: 1, name: this.name, maxLength: this.maxLength, fieldLabel: this.fieldLabel, labelWidth: this.labelWidth, listeners: this.listeners, store: this.store, displayField: this.displayField, valueField: this.valueField, emptyText: this.emptyText, autoSelect: this.autoSelect, queryMode: this.queryMode, triggerAction: this.triggerAction, typeAhead: this.typeAhead, minChars: this.minChars, multiSelect: this.multiSelect, msgTarget: 'none', tpl: this.tpl }, { xtype: 'image', name: 'warnImg', src: 'resources/img/icon-warning.gif', width: 12, height: 12, hidden: true }, { xtype: 'image', name: 'errorImg', src: 'resources/img/icon-error.gif', width: 12, height: 12, hidden: true }]; this.callParent(arguments); }, showWarnings: function(warnings) { var img = this.down('image[name=warnImg]'); Ext.create('Ext.tip.ToolTip', { target: img.getEl(), html: warnings }); this.down('combobox').invalidCls = 'x-lada-warning'; this.down('combobox').markInvalid(''); img.show(); var fieldset = this.up('fieldset[collapsible=true]'); if (fieldset) { fieldset.showWarnings(warnings); } }, showErrors: function(errors) { var img = this.down('image[name=errorImg]'); var warnImg = this.down('image[name=warnImg]'); warnImg.hide(); Ext.create('Ext.tip.ToolTip', { target: img.getEl(), html: errors }); this.down('combobox').invalidCls = 'x-lada-error'; this.down('combobox').markInvalid(''); img.show(); var fieldset = this.up('fieldset[collapsible=true]'); if (fieldset) { fieldset.showErrors(); } }, clearWarningOrError: function() { this.down('image[name=errorImg]').hide(); this.down('image[name=warnImg]').hide(); }, getValue: function() { return this.down('combobox').getValue(); }, getName: function() { return this.name; }, setReadOnly: function(value) { this.down('combobox').setReadOnly(value); } });