| | 306 | // toggle "all" checkbox when checking a checkbox |
| | 307 | $('tbody .check-column :checkbox').click( function(e) { |
| | 308 | |
| | 309 | var this_checkbox = $(this); |
| | 310 | |
| | 311 | $(this).closest('table').children('thead, tfoot').filter(':visible') |
| | 312 | .children().children('.check-column').find(':checkbox') |
| | 313 | .prop('checked', function() { |
| | 314 | |
| | 315 | var all_checked = true; |
| | 316 | |
| | 317 | this_checkbox.closest( 'table' ).children( 'tbody' ).filter(':visible') |
| | 318 | .children().children('.check-column').find(':checkbox').each( function(){ |
| | 319 | if ( !$(this).prop('checked') ) { |
| | 320 | all_checked = false; |
| | 321 | } |
| | 322 | }); |
| | 323 | |
| | 324 | if (all_checked) { |
| | 325 | return true; |
| | 326 | } else { |
| | 327 | return false; |
| | 328 | } |
| | 329 | |
| | 330 | }); |
| | 331 | |
| | 332 | }); |
| | 333 | |