Show More
@@ -124,14 +124,25 b' define([' | |||
|
124 | 124 | $('.delete-button').click($.proxy(this.delete_selected, this)); |
|
125 | 125 | |
|
126 | 126 | // Bind events for selection menu buttons. |
|
127 |
$('#selector-menu').click(function(event){ |
|
|
128 | $('#select-all').change(function(){that.select($(this).is(':checked') ? 'select-all' : 'select-none')}); | |
|
129 | $('#button-select-all').click(function(e) { | |
|
127 | $('#selector-menu').click(function (event) { | |
|
128 | that.select($(event.target).attr('id')); | |
|
129 | }); | |
|
130 | var select_all = $('#select-all'); | |
|
131 | select_all.change(function () { | |
|
132 | if (!select_all.prop('checked') || select_all.data('indeterminate')) { | |
|
133 | that.select('select-none'); | |
|
134 | } else { | |
|
135 | that.select('select-all'); | |
|
136 | } | |
|
137 | }); | |
|
138 | $('#button-select-all').click(function (e) { | |
|
130 | 139 | // toggle checkbox if the click doesn't come from the checkbox already |
|
131 | 140 | if (!$(e.target).is('input[type=checkbox]')) { |
|
132 | var checkbox = $('#select-all'); | |
|
133 | checkbox.prop('checked', !checkbox.prop('checked')); | |
|
134 | that.select(checkbox.prop('checked') ? 'select-all' : 'select-none'); | |
|
141 | if (select_all.prop('checked') || select_all.data('indeterminate')) { | |
|
142 | that.select('select-none'); | |
|
143 | } else { | |
|
144 | that.select('select-all'); | |
|
145 | } | |
|
135 | 146 | } |
|
136 | 147 | }); |
|
137 | 148 | } |
@@ -481,15 +492,20 b' define([' | |||
|
481 | 492 | total++; |
|
482 | 493 | } |
|
483 | 494 | }); |
|
495 | ||
|
496 | var select_all = $("#select-all"); | |
|
484 | 497 | if (checked === 0) { |
|
485 | $('#tree-selector input[type=checkbox]')[0].indeterminate = false; | |
|
486 | $('#tree-selector input[type=checkbox]').prop('checked', false); | |
|
498 | select_all.prop('checked', false); | |
|
499 | select_all.prop('indeterminate', false); | |
|
500 | select_all.data('indeterminate', false); | |
|
487 | 501 | } else if (checked === total) { |
|
488 | $('#tree-selector input[type=checkbox]')[0].indeterminate = false; | |
|
489 | $('#tree-selector input[type=checkbox]').prop('checked', true); | |
|
502 | select_all.prop('checked', true); | |
|
503 | select_all.prop('indeterminate', false); | |
|
504 | select_all.data('indeterminate', false); | |
|
490 | 505 | } else { |
|
491 |
|
|
|
492 |
|
|
|
506 | select_all.prop('checked', false); | |
|
507 | select_all.prop('indeterminate', true); | |
|
508 | select_all.data('indeterminate', true); | |
|
493 | 509 | } |
|
494 | 510 | // Update total counter |
|
495 | 511 | $('#counter-select-all').html(checked===0 ? ' ' : checked); |
General Comments 0
You need to be logged in to leave comments.
Login now