raimund@770: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz raimund@770: * Software engineering by Intevation GmbH raimund@770: * raimund@770: * This file is Free Software under the GNU GPL (v>=3) raimund@770: * and comes with ABSOLUTELY NO WARRANTY! Check out raimund@770: * the documentation coming with IMIS-Labordaten-Application for details. raimund@770: */ raimund@770: raimund@770: /** raimund@770: * Combobox for Deskriptor raimund@770: */ raimund@770: Ext.define('Lada.view.widget.Deskriptor', { raimund@770: extend: 'Lada.view.widget.base.ComboBox', raimund@770: alias: 'widget.deskriptor', raimund@850: displayField: 'id', raimund@770: valueField: 'id', raimund@770: // Enable filtering of comboboxes raimund@770: triggerAction: 'all', raimund@770: typeAhead: false, raimund@770: layer: null, raimund@849: queryMode: 'remote', raimund@849: remoteFilter: true, raimund@850: tpl: Ext.create('Ext.XTemplate', raimund@850: '' + raimund@850: '{sn} - {beschreibung}'), raimund@850: displayTpl: Ext.create('Ext.XTemplate', raimund@850: '{sn} - {beschreibung}'), raimund@849: raimund@770: listeners: { raimund@849: focus: { raimund@770: fn: function(field) { raimund@770: if (field.up('deskriptor').layer === 0) { raimund@770: field.store.proxy.extraParams = {'layer': field.up('deskriptor').layer}; raimund@770: } raimund@770: else { raimund@770: var parents = field.up('deskriptor').getParents(this); raimund@770: if (parents !== '') { raimund@770: field.store.proxy.extraParams = { raimund@770: 'layer': field.up('deskriptor').layer, raimund@770: 'parents': parents raimund@770: }; raimund@770: field.store.load(); raimund@770: } raimund@770: } raimund@770: } raimund@770: } raimund@770: }, raimund@770: raimund@770: initComponent: function() { raimund@770: this.store = Ext.create('Lada.store.Deskriptoren'); raimund@770: raimund@770: this.callParent(arguments); raimund@783: this.down('combobox').isFormField = false; raimund@770: }, raimund@770: raimund@770: getParents: function(field) { raimund@770: var set = field.up('fieldset'); raimund@770: var allS = set.items.items; raimund@770: var p = ''; raimund@770: raimund@770: for (var i = 0; i < field.up('deskriptor').layer; i++) { raimund@770: if (allS[i].getValue() > 0) { raimund@770: p += allS[i].getValue(); raimund@770: if (i < field.up('deskriptor').layer - 1) { raimund@770: p += ', '; raimund@770: } raimund@770: } raimund@770: } raimund@770: return p; raimund@770: } raimund@770: });