Avoid javascript error because of hidden columns

Cannot read property 'mData' of undefined
This commit is contained in:
savvasha
2019-06-15 08:35:09 +03:00
committed by GitHub
parent c804bf384a
commit 9e69d734b3

View File

@@ -4,7 +4,7 @@
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 2.6.15
* @version 2.6.19
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -172,8 +172,11 @@ $identifier = uniqid( 'eventlist_' );
if ( sp_column_active( $usecolumns, 'season' ) )
echo '<th class="data-season">' . __( 'Season', 'sportspress' ) . '</th>';
if ( sp_column_active( $usecolumns, 'venue' ) )
if ( sp_column_active( $usecolumns, 'venue' ) ) {
echo '<th class="data-venue">' . __( 'Venue', 'sportspress' ) . '</th>';
}else{
echo '<th style="display:none;" class="data-venue">' . __( 'Venue', 'sportspress' ) . '</th>';
}
if ( sp_column_active( $usecolumns, 'article' ) )
echo '<th class="data-article">' . __( 'Article', 'sportspress' ) . '</th>';
@@ -251,7 +254,6 @@ $identifier = uniqid( 'eventlist_' );
endif;
echo '<tr class="sp-row sp-post' . ( $i % 2 == 0 ? ' alternate' : '' ) . ' sp-row-no-' . $i . '" itemscope itemtype="http://schema.org/SportsEvent">';
echo '<td style="display:none;" itemprop="name">'.$event->post_title.'</td>';
$date_html = '<date>' . get_post_time( 'Y-m-d H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_date', get_post_time( get_option( 'date_format' ), false, $event, true ), $event->ID );
@@ -307,7 +309,7 @@ $identifier = uniqid( 'eventlist_' );
echo '<td class="data-event data-teams" data-label="'.__( 'Teams', 'sportspress' ).'">' . $teams_output . '</td>';
} else {
$title_html = implode( ' ', $team_logos ) . ' ' . $event->post_title;
if ( $link_events ) $title_html = '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">' . $title_html . '</a>';
if ( $link_events ) $title_html = '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url name">' . $title_html . '</a>';
echo '<td class="data-event" data-label="'.__( 'Event', 'sportspress' ).'">' . $title_html . '</td>';
}
}