Fix empty team checkboxes in player quick edit

This commit is contained in:
Brian Miyaji
2017-01-26 14:13:30 +11:00
parent 5398a48402
commit 256a4839a1
2 changed files with 16 additions and 11 deletions

View File

@@ -25,9 +25,17 @@
// get the data
var $number = $( '.column-sp_number', $post_row ).text();
var $current_teams = String( $( '.column-sp_team', $post_row ).find( '.sp-player-teams' ).data( 'current-teams' ) ).split(',');
var $past_teams = String( $( '.column-sp_team', $post_row ).find( '.sp-player-teams' ).data( 'past-teams' ) ).split(',');
// populate the data
$( ':input[name="sp_number"]', $edit_row ).val( $number );
$( ':input[name="sp_current_team[]"]', $edit_row ).each(function() {
$(this).prop("checked", ($.inArray($(this).val(), $current_teams ) != -1));
});
$( ':input[name="sp_past_team[]"]', $edit_row ).each(function() {
$(this).prop("checked", ($.inArray($(this).val(), $past_teams ) != -1));
});
}
};