Recent Games
us.team.mlb.recentGames displays upcoming and/or past games of a selected team.
For the widget to render you must provide a valid teamUid
.
Parameters
Name | Type | Description | ||||
---|---|---|---|---|---|---|
props |
object | properties | ||||
Name | Type | Argument | Default | Description | ||
teamUid |
number | Unique Team ID | ||||
pastGames |
number | optional | 20 | Number of past games to display. | ||
nextGames |
number | optional | 1 | Number of future games to display. | ||
currentSeason |
boolean | optional | true | If true provides games of current season only. |
||
sortDirection |
string | optional | desc | Changes groups and games sort direction. Valid options are: asc and desc . |
||
disableTeamDropdown |
boolean | optional | If true disables the team selection dropdown. |
|||
disableHeader |
boolean | optional | If true hides the widget header. |
|||
border |
boolean | optional | If true enables a border around the widget. |
|||
onItemClick |
function | optional | Function/event handler. Emits matchId , seasonId , tournamentId , uniqueTournamentId and other props on table row upon click or touch. See example below. |
Examples
<div class="sr-widget" data-sr-widget="us.team.mlb.recentGames" data-sr-team-uid="3654" data-sr-past-games="10" data-sr-next-games="1"></div>
<script type="application/javascript" src="https://widgets.media.sportradar.com/YOUR_CLIENT_ALIAS/widgetloader" data-sr-language="en_us" async></script>
Please note that in HTML prop names change from CamelCase to hyphen-word-delimited notation (i.e. pastGames to past-games)
<script>
(function(a,b,c,d,e,f,g,h,i){a[e]||(i=a[e]=function(){(a[e].q=a[e].q||[]).push(arguments)},i.l=1*new Date,i.o=f,
g=b.createElement(c),h=b.getElementsByTagName(c)[0],g.async=1,g.src=d,g.setAttribute("n",e),h.parentNode.insertBefore(g,h)
)})(window,document,"script","https://widgets.media.sportradar.com/YOUR_CLIENT_ALIAS/widgetloader","SIR", {
language: 'en_us'
});
SIR('addWidget', '#sr-widget', 'us.team.mlb.recentGames', {teamUid: 3654});
</script>
<div id="sr-widget"></div>
<script>
(function(a,b,c,d,e,f,g,h,i){a[e]||(i=a[e]=function(){(a[e].q=a[e].q||[]).push(arguments)},i.l=1*new Date,i.o=f,
g=b.createElement(c),h=b.getElementsByTagName(c)[0],g.async=1,g.src=d,g.setAttribute("n",e),h.parentNode.insertBefore(g,h)
)})(window,document,"script","https://widgets.media.sportradar.com/YOUR_CLIENT_ALIAS/widgetloader","SIR", {
language: 'en_us'
});
SIR('addWidget', '#sr-widget', 'us.team.mlb.recentGames', {teamUid: 3654, onItemClick: function(type, obj){alert(JSON.stringify(obj));}});
</script>
<div id="sr-widget"></div>
"match":{"matchId":25327580,"seasonId":79507,"tournamentId":25,"uniqueTournamentId":109,"realCategoryId":16,"sportId":3,"awayTeamUid":3654,"homeTeamUid":3646,"matchStatus":"post"}
Updated almost 2 years ago