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