I have the following data in a table:
data = [
{id: 1, name: 'Manchester United', type: 'Soccer', featured: true, country: 'England'},
{id: 2, name: 'Manchester City', type: 'Soccer', featured: false, country: 'England'},
{id: 3, name: 'Dallas Mavericks', type: 'Basketball', featured: true, country: 'USA'},
{id: 4, name: 'Indian Cricket Team', type: 'Cricket', featured: true, country: 'India'},
{id: 5, name: 'Australian Cricket Team', type: 'Cricket', featured: false, country: 'Australia'},
{id: 6, name: 'Los Angeles Lakers', type: 'Basketball', featured: true, country: 'USA'},
{id: 7, name: 'Los Angeles Clippers', type: 'Basketball', featured: false, country: 'USA'}
];
I want to add a drop down box with countries. Selecting a country should filter the table to show only sports from that country.
The problem is that I am unable to show the unique countries in the dropdown.
Kindly Help...Thanks in advance.
dataonce and build the list of unique countries.lowdashto preprocess your data.