mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02: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
|
// setup original values
|
||||||
var fields = this.getFields();
|
var fields = this.getFields();
|
||||||
fields.filter(':radio,:checkbox').bind('click', onchange);
|
fields.filter(':radio,:checkbox').bind('click.changetracker', onchange);
|
||||||
fields.not(':radio,:checkbox').bind('change', onchange);
|
fields.not(':radio,:checkbox').bind('change.changetracker', onchange);
|
||||||
fields.each(function() {
|
fields.each(function() {
|
||||||
var origVal = $(this).is(':radio,:checkbox') ? self.find(':input[name=' + $(this).attr('name') + ']:checked').val() : $(this).val();
|
var origVal = $(this).is(':radio,:checkbox') ? self.find(':input[name=' + $(this).attr('name') + ']:checked').val() : $(this).val();
|
||||||
$(this).data('changetracker.origVal', origVal);
|
$(this).data('changetracker.origVal', origVal);
|
||||||
@ -77,6 +77,14 @@
|
|||||||
this.data('changetracker', true);
|
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.
|
* Reset change state of all form fields and the form itself.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user