+<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
+<script text="text/javascript">
+
+var inserts = {
+ '#checkAll': function (e) {
+ e.onchange = function() {
+ $('.check_detail').prop('checked', e.checked)
+ $('.check_detail').trigger('change');
+ }
+ }
+ ,'tr': function(e) {
+ // find if there is a check detail box on link all input to it
+ var tr = $(e);
+ var check = tr.find('.check_detail');
+ if(check.length != 1) return;
+ check = check[0];
+ var jcheck = $(check);
+ var inputs = tr.find('input');
+ inputs.each(function(index, input) {
+ if(input === check) return;
+ $(input).prop('disabled', true)
+ })
+
+ check.onchange = function() {
+ inputs.each(function(index, input) {
+ var on = jcheck.prop('checked')
+ if(input == check) return;
+ $(input).prop('disabled', !on);
+ })
+ };
+ }
+ }
+Behaviour.register(inserts);
+</script>