Widgets.us.season.mlb.TopTeams

us.season.mlb.topTeams shows list of top teams for selected category.

For the widget to render you need to provide seasonId.


new TopTeams(props)

Parameters
Name Type Description
props object
Properties
Name Type Argument Default Description
seasonId number

Season id.

seasonType string <optional>
'regular'

Selected season type. Can be regular, playoffs.

conference string <optional>
'all'

Selected conference. Can be al, nl or undefined (i.e. all).

statType string <optional>
'points'

Selected stat. Can be points, hitting_at_bats_per_homerun, hitting_batting_average, hitting_doubles, hitting_extra_base_hits, hitting_hits, hitting_home_runs, hitting_isolated_power, hitting_on_base_percentage, hitting_on_base_percentage_plus_slugging, hitting_runs_batted_in, hitting_slugging_percentage, hitting_triples, hitting_walks_per_strikeout, hitting_ground_out_to_fly_out_ratio, hitting_ground_out_to_air_out_ratio, pitching_overall_complete_games, pitching_overall_earned_run_average, pitching_overall_opponents_batting_average, pitching_overall_quality_starts, pitching_overall_shutouts, pitching_overall_strikeouts_per_9_innings, pitching_overall_strikeouts_per_walk, pitching_overall_total_strikeouts, pitching_overall_walks, pitching_overall_walks_plus_hits_per_innings_pitched, pitching_overall_ground_out_to_fly_out_ratio, pitching_overall_ground_out_to_air_out_ratio.

disableDropdown boolean <optional>

If true hides dropdown.

teamsLimit number <optional>
5

Limits list length.

border boolean <optional>

If true enables a border around the widget.

onItemClick function <optional>

Function/event handler. Emits event object on team row click or touch.

Examples

HTML/Declarative

<div class="sr-widget" data-sr-widget="us.season.mlb.topTeams" data-sr-season-id="38836"></div>
<script type="application/javascript" src="https://widgets.media.sportradar.com/uscommon/widgetloader" data-sr-language="en_us" async></script>

JS/Programmatic

<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/uscommon/widgetloader","USW", {
        language: 'en_us'
    });
    USW('addWidget', '#sr-widget', 'us.season.mlb.topTeams', {seasonId: 38836, statType: 'hitting_batting_average'});
</script>
<div id="sr-widget"></div>

JS/Example of using Event Handler

<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/uscommon/widgetloader","USW", {
        language: 'en_us'
    });
    USW('addWidget', '#sr-widget', 'us.season.mlb.topTeams', {seasonId: 38836, statType: 'pitching_overall_earned_run_average', teamsLimit: '10', onItemClick: function(type, obj){alert('uniqueTeamId: ' + obj.uniqueTeamId);}});
</script>
<div id="sr-widget"></div>