Add totals for number format values only

This commit is contained in:
Brian Miyaji
2016-02-24 13:35:24 +11:00
parent 89c40166a5
commit 3ab665bf22
2 changed files with 4 additions and 2 deletions

View File

@@ -237,7 +237,7 @@ jQuery(document).ready(function($){
});
// Total stats calculator
$(".sp-data-table .sp-total input").on("updateTotal", function() {
$(".sp-data-table .sp-total input[data-sp-format=number]").on("updateTotal", function() {
index = $(this).parent().index();
var sum = 0;
$(this).closest(".sp-data-table").find(".sp-post").each(function() {

View File

@@ -252,8 +252,10 @@ class SP_Meta_Box_Event_Performance {
$player_id = 0;
$player_performance = sp_array_value( $data, $player_id, array() );
$value = sp_array_value( $player_performance, $column, '' );
$format = sp_array_value( $formats, $column, 'number' );
$placeholder = sp_get_format_placeholder( $format );
?>
<td><input type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" placeholder="0" value="<?php echo esc_attr( $value ); ?>" /></td>
<td><input type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" placeholder="<?php echo trim( $placeholder ); ?>" value="<?php echo esc_attr( $value ); ?>" data-sp-format="<?php echo $format; ?>" /></td>
<?php endforeach; ?>
<?php if ( $status ) { ?>
<td>&nbsp;</td>