| | 465 | //Enable and Disable Apply button |
| | 466 | $('select[name="action"], select[name="action2"]').on( 'change', function() { |
| | 467 | setApplyButton(); |
| | 468 | }); |
| | 469 | //Enable and Disable Apply button |
| | 470 | $('table').find('.check-column :checkbox').on( 'click.wp-toggle-checkboxes', function() { |
| | 471 | setApplyButton(); |
| | 472 | }); |
| | 473 | |
| | 474 | /** |
| | 475 | * Enable and Disable Apply button in wp-list |
| | 476 | */ |
| | 477 | function setApplyButton() { |
| | 478 | var bulk_action = $('select[name="action"]').val(); |
| | 479 | var bulk_action2 = $('select[name="action2"]').val(); |
| | 480 | |
| | 481 | var selected_rows_count = $('tbody th.check-column input[type="checkbox"]:checked').length; |
| | 482 | |
| | 483 | //Check bulk action selector top value |
| | 484 | if( '-1' !== bulk_action && selected_rows_count > 0 ) { |
| | 485 | $('#doaction').removeAttr('disabled'); |
| | 486 | } else { |
| | 487 | $('#doaction').attr('disabled', 'disabled'); |
| | 488 | } |
| | 489 | |
| | 490 | //Check bulk action selector bottom value |
| | 491 | if( '-1' !== bulk_action2 && selected_rows_count > 0 ) { |
| | 492 | $('#doaction2').removeAttr('disabled'); |
| | 493 | } else { |
| | 494 | $('#doaction2').attr('disabled', 'disabled'); |
| | 495 | } |
| | 496 | } |
| | 497 | |