You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm testing the groupBy option with the demo provided. The demo array "teams" is structured so to have all the items from the first category first, and then lists all the item from the second category:
var nhlTeams = ['Anaheim Ducks', 'Atlanta Thrashers', 'Boston Bruins', ...];
var nbaTeams = ['Atlanta Hawks', 'Boston Celtics', 'Charlotte Bobcats', ...];
var nhl = $.map(nhlTeams, function (team) { return { value: team, data: { category: 'NHL' }}; });
var nba = $.map(nbaTeams, function (team) { return { value: team, data: { category: 'NBA' } }; });
var teams = nhl.concat(nba);
This way, when we perform a search using the groupBy option, the search results shows first all the results from the first category, then all the results from the second category. In this way, the results from the same category are grouped together:
If we shuffle the teams items in the array so that final results from both categories are mixed:
searchquery = "bl";
var teamsddd = [
{"value": "Anaheim Ducks", "data": {"category": "NHL"}},
{"value": "Portland Trail Blazers", "data": {"category": "NBA"}}, // this will show in search with category NBA
{"value": "Atlanta Thrashers", "data": {"category": "NHL"}},
{"value": "Chicago Blackhawks", "data": {"category": "NHL"}}, // this will show in search with category NHL
{"value": "Boston BlCeltics", "data": {"category": "NBA"}}, // this will show in search with category NBA
{"value": "Columbus Blue Jackets", "data": {"category": "NHL"}}, // this will show in search with category NHL
{"value": "Detroit Red Wings", "data": {"category": "NHL"}},
{"value": "Atlanta Hawks", "data": {"category": "NBA"}},
{"value": "Cleveland Cavaliers", "data": {"category": "NBA"}},
{"value": "Dallas Mavericks", "data": {"category": "NBA"}},
];
I expect to still see the results grouped by their categories, so I expect to see the first category with its two entries, and then the second category with the other two entries, no matter where they are in the array:
NBA
- portland trail blazers // array position 2
- boston Blceltics // array position 5
NHL
- chicago blackhawks // array position 4
- columbus blue jackets // array position 6
What I get, instead, is the four items of the array in the order that are listed in the array:
Basically, the grouping gets lost. Is this intended behaviour? To me, a groupBy option means that results should be grouped under that category depsite their original position in the array
The text was updated successfully, but these errors were encountered:
I'm testing the groupBy option with the demo provided. The demo array "teams" is structured so to have all the items from the first category first, and then lists all the item from the second category:
This way, when we perform a search using the groupBy option, the search results shows first all the results from the first category, then all the results from the second category. In this way, the results from the same category are grouped together:
If we shuffle the teams items in the array so that final results from both categories are mixed:
I expect to still see the results grouped by their categories, so I expect to see the first category with its two entries, and then the second category with the other two entries, no matter where they are in the array:
What I get, instead, is the four items of the array in the order that are listed in the array:
Basically, the grouping gets lost. Is this intended behaviour? To me, a groupBy option means that results should be grouped under that category depsite their original position in the array
The text was updated successfully, but these errors were encountered: