mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°3979 - Handle initial values on dependent fields (#325)
N°3979 - Handle initial values on dependent fields
This commit is contained in:
@@ -92,12 +92,24 @@ $(function()
|
||||
{
|
||||
return this.options.field_set.triggerHandler('get_current_values');
|
||||
},
|
||||
|
||||
//since 3.0.2 3.1.0
|
||||
_updatePreviousValues: function()
|
||||
{
|
||||
let me = this;
|
||||
if(this.element.find('[data-attribute-previous-value]').length>0) {
|
||||
let aPreviousValues = {};
|
||||
$(this.element.find('[data-attribute-previous-value]')).each(function (idx, elt) {
|
||||
aPreviousValues[$(elt).data('field-id')] = $(elt).data('attribute-previous-value');
|
||||
});
|
||||
me.element.find('[data-field-id="previous_values"]').find('input[type="hidden"]').val(JSON.stringify(aPreviousValues));
|
||||
}
|
||||
},
|
||||
// Events callback
|
||||
// - Update fields depending on the update ones
|
||||
_onUpdateFields: function(oEvent, oData)
|
||||
{
|
||||
var me = this;
|
||||
me._updatePreviousValues();
|
||||
var sFormPath = oData.form_path;
|
||||
|
||||
// Data checks
|
||||
|
||||
Reference in New Issue
Block a user