mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Added destroy() method to jQuery.changetracker plugin
This commit is contained in:
parent
6c1f7997a4
commit
0b6d45356e
@ -67,8 +67,8 @@
|
||||
|
||||
// setup original values
|
||||
var fields = this.getFields();
|
||||
fields.filter(':radio,:checkbox').bind('click', onchange);
|
||||
fields.not(':radio,:checkbox').bind('change', onchange);
|
||||
fields.filter(':radio,:checkbox').bind('click.changetracker', onchange);
|
||||
fields.not(':radio,:checkbox').bind('change.changetracker', onchange);
|
||||
fields.each(function() {
|
||||
var origVal = $(this).is(':radio,:checkbox') ? self.find(':input[name=' + $(this).attr('name') + ']:checked').val() : $(this).val();
|
||||
$(this).data('changetracker.origVal', origVal);
|
||||
@ -76,6 +76,14 @@
|
||||
|
||||
this.data('changetracker', true);
|
||||
};
|
||||
|
||||
this.destroy = function() {
|
||||
this.getFields()
|
||||
.unbind('.changetracker')
|
||||
.removeClass(options.changedCssClass)
|
||||
.removeData('changetracker.origVal');
|
||||
this.removeData('changetracker');
|
||||
};
|
||||
|
||||
/**
|
||||
* Reset change state of all form fields and the form itself.
|
||||
|
Loading…
x
Reference in New Issue
Block a user