More events from the property_field widgets to inform the enclosing form of the state changes.

SVN:trunk[4598]
This commit is contained in:
Denis Flaven
2017-03-17 10:55:06 +00:00
parent e41a8833e2
commit cf0792cd64

View File

@@ -97,6 +97,7 @@ $(function()
if (this._equals(new_value, this.value)) if (this._equals(new_value, this.value))
{ {
this.bModified = false; this.bModified = false;
this._notify_as_clean(true);
} }
else else
{ {
@@ -105,6 +106,10 @@ $(function()
{ {
this._do_apply(); this._do_apply();
} }
else
{
this._notify_as_dirty();
}
} }
this._refresh(); this._refresh();
if (this.options.parent_selector) if (this.options.parent_selector)
@@ -112,6 +117,14 @@ $(function()
$(this.options.parent_selector).trigger('subitem_changed'); $(this.options.parent_selector).trigger('subitem_changed');
} }
}, },
_notify_as_dirty: function()
{
this.element.closest('form').trigger('property_field_dirty', { id: this.options.field_id, reason: 'modified' });
},
_notify_as_clean: function(bRevert)
{
this.element.closest('form').trigger('property_field_clean', { id: this.options.field_id, reason: (bRevert ? 'revert' : 'apply') });
},
_equals: function( value1, value2 ) _equals: function( value1, value2 )
{ {
if (this.options.equals === null) if (this.options.equals === null)
@@ -142,6 +155,10 @@ $(function()
return this.options.get_field_value(); return this.options.get_field_value();
} }
}, },
get_field_value: function()
{
return this._get_field_value();
},
get_field_name: function() get_field_name: function()
{ {
return $('#'+this.options.field_id, this.element).attr('name'); return $('#'+this.options.field_id, this.element).attr('name');
@@ -186,6 +203,7 @@ $(function()
this._refresh(); this._refresh();
} }
} }
this._notify_as_clean(false);
}, },
_do_cancel: function() _do_cancel: function()
{ {
@@ -221,6 +239,7 @@ $(function()
$(this.options.parent_selector).trigger('subitem_changed'); $(this.options.parent_selector).trigger('subitem_changed');
} }
} }
this._notify_as_clean(true);
}, },
_do_submit: function() _do_submit: function()
{ {