Plugins: Fix checkbox selection when searching for installed plugins.
Since the plugin search works via Ajax, the JavaScript events need to delegated in order for the checkboxes to work properly. Props afercia. Fixes #37973. git-svn-id: https://develop.svn.wordpress.org/trunk@38703 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a39953e1e3
commit
fd5d2a65ad
|
@ -426,10 +426,11 @@ $document.ready( function() {
|
|||
// Init screen meta
|
||||
screenMeta.init();
|
||||
|
||||
// check all checkboxes
|
||||
$('tbody').children().children('.check-column').find(':checkbox').click( function(e) {
|
||||
if ( 'undefined' == e.shiftKey ) { return true; }
|
||||
if ( e.shiftKey ) {
|
||||
// This event needs to be delegated. Ticket #37973.
|
||||
$body.on( 'click', 'tbody .check-column :checkbox', function( even ) {
|
||||
// Shift click to select a range of checkboxes.
|
||||
if ( 'undefined' == event.shiftKey ) { return true; }
|
||||
if ( event.shiftKey ) {
|
||||
if ( !lastClicked ) { return true; }
|
||||
checks = $( lastClicked ).closest( 'form' ).find( ':checkbox' ).filter( ':visible:enabled' );
|
||||
first = checks.index( lastClicked );
|
||||
|
@ -447,7 +448,7 @@ $document.ready( function() {
|
|||
}
|
||||
lastClicked = this;
|
||||
|
||||
// toggle "check all" checkboxes
|
||||
// Toggle the "Select all" checkboxes depending if the other ones are all checked or not.
|
||||
var unchecked = $(this).closest('tbody').find(':checkbox').filter(':visible:enabled').not(':checked');
|
||||
$(this).closest('table').children('thead, tfoot').find(':checkbox').prop('checked', function() {
|
||||
return ( 0 === unchecked.length );
|
||||
|
@ -456,7 +457,8 @@ $document.ready( function() {
|
|||
return true;
|
||||
});
|
||||
|
||||
$('thead, tfoot').find('.check-column :checkbox').on( 'click.wp-toggle-checkboxes', function( event ) {
|
||||
// This event needs to be delegated. Ticket #37973.
|
||||
$body.on( 'click.wp-toggle-checkboxes', 'thead .check-column :checkbox, tfoot .check-column :checkbox', function( event ) {
|
||||
var $this = $(this),
|
||||
$table = $this.closest( 'table' ),
|
||||
controlChecked = $this.prop('checked'),
|
||||
|
|
Loading…
Reference in New Issue