Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 9d3dcb66 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Remove DictMultiDefault.js.

parent ee46e174
......@@ -183,7 +183,6 @@ Each widget is defined by its ``xtype`` configuration parameters:
ComboBoxUserReset xcomboboxuserreset
Date datefield
Dict xdictfield
DictMultiDefault xdictmultidefault
HtmlEditor htmleditor
List xlistfield
Number numberfield
......
--------------------------------- CHANGE LOG ----------------------------------
HEAD
- Fix AceEditor class in order to run with Ext JS 6
- Remove the JavaScript class DictMultiDefault.
0.9.2 (Sep 2016)
- Add the base class Dbui.grid.plugin.ContextMenu
......
......@@ -31,7 +31,6 @@ Ext.define('Dbui.form.Panel', {
'Dbui.form.field.ComboBoxSlave',
'Dbui.form.field.ComboBoxUserReset',
'Dbui.form.field.Dict',
'Dbui.form.field.DictMultiDefault',
'Dbui.form.field.List',
'Dbui.form.field.TextPicker',
'Ext.form.field.Date',
......
/**
* A dictionary handling several default values.
*
* This field is linked to a ComboBox field. The value selected
* in this comboBox define the default dictionary which has to be used.
*
* @experimental
* @since 0.6.2
*
*/
Ext.define('Dbui.form.field.DictMultiDefault', {
extend: 'Dbui.form.field.Dict',
alias: 'widget.xdictmultidefault',
/**
* @cfg {Ext.data.Store/String} store (required)
* the store should a list contains the key, selected by the comboBox,
* and the associated dictionary definition.
*
*/
/**
* @cfg {String} dictField (required)
* The field in the store contain dictionary definition.
*/
/**
* @cfg {String} comboBoxItemId (required)
* The itemId of the comboBox.
*/
// private attributes
combo: null,
lastKey: undefined,
// jshint strict: false
// private method requests by the component model of ExtJS
initComponent: function () {
var me = this;
// instantiate the base class
me.callParent(arguments);
// instantiate the store containing the relation
// between the key and the dictionary configuration
me.store = Dbui.getStore(me.store);
// bind me to the comboBox
me.on('afterrender', me.bindToComboBox, me);
},
// private method requests by the component model of ExtJS
beforeDestroy: function () {
var me = this;
me.un('afterrender', me.bindToComboBox, me);
me.combo.un('select', me.onComboBoxSelect, me);
me.callParent(arguments);
},
//
// Override Dbui.form.field.Dict to store the lastKey.
// The lastKey is the value of the ComboBox when setting
// the value of the DictMultiDefault.
// It is used to reload the original value when changing
// the key.
//
// NOTE: this method is called before the rendering.
// Therefore the ComboBox is linked here.
//
// @param {Object} value
//
// @return {Dbui.form.field.DictMultiDefault}
//
setValue: function (value) {
var me = this;
// link me to the ComboBox
if (value && !me.combo) {
if (!me.combo) {
me.combo = me.up('xform, form').down('#' + me.comboBoxItemId);
}
}
// keep track of the value load in the ComboBox
// replace empty string by empty dictionary
if (me.combo) {
me.lastKey = me.combo.getValue();
if (!value) {
value = {};
}
}
return me.callParent([value]);
},
// jshint strict: true
//
// Bind the ComboBox and the Dict field.
// The handler is triggered by the afterrender event.
//
bindToComboBox: function () {
"use strict";
var me = this;
me.combo = me.up('xform, form').down('#' + me.comboBoxItemId);
me.combo.on('select', me.onComboBoxSelect, me);
},
//
// Handle the ComboBox select event
//
// @param {Ext.form.field.ComboBox} combo
// @param {Ext.data.Model} record
// @param {Object} eOpts
//
onComboBoxSelect: function (combo, record) {
"use strict";
var me = this;
me.originalValue = record.get(me.dictField);
// load the current value if the key is back to the original one
if (combo.getValue() === me.lastKey) {
me.grid.setSource(me.value);
// load default value
} else {
me.grid.setSource(me.originalValue);
}
}
});
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment