MINOR Fixed PermissionCheckboxSetField.js checkbox toggling when no previous values have been saved through jQuery.data()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@101070 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-03-15 21:27:06 +00:00 committed by Sam Minnee
parent 2c809ccd87
commit 0eab4a2daf

View File

@ -24,8 +24,11 @@
});
} else {
checkboxes.each(function() {
$(this).attr('checked', $(this).data('SecurityAdmin.oldChecked'));
$(this).attr('disabled', $(this).data('SecurityAdmin.oldDisabled'));
// only update attributes if previous values have been saved
var oldChecked = $(this).data('SecurityAdmin.oldChecked');
var oldDisabled = $(this).data('SecurityAdmin.oldDisabled');
if(oldChecked != null) $(this).attr('checked', oldChecked);
if(oldDisabled != null) $(this).attr('disabled', oldDisabled);
});
}
}