Need help displaying pair of players

My table has the structure

Player1, array of possible opponents P2,P4

Player2, array of possible opponents P1,P3

etc

The goal is to display list of all possible pairs with player names and photos in another form

I am struggling to find component that would display two images (each for single opponent from the pair) in a card.

The solution to came on my mind is to have a custom collection with two title components or to use cloudinary to merge images into a single image.

Really stuck currently. Not even sure how to connect relations

Whenever I need something a little more custom, I create a template column with HTML. Usually that HTML includes an HTML table to lay everything out the way I want. Then I only need a Rich Text component in the custom collection to display that template column.

This is an example in my app. This is a custom collection with only a rich text component. I dynamically build the html in the table for each row. Glide doesn’t have a collection layout that I was satisfied with, so I created my own. Nothing extravagant, but you get the idea. Have all of the player images and details in each row, and then you can piece it together with some html to get the look you want.

2 Likes

Thanks Jeff, great out of the box solution.

There is an even tougher problem to solve before that. I’ve scratching my head for hours and can’t find a solution:

The opponents data are currently in a table with two columns:

Player 1 ID, arrayPotentialOpponents (P2,P4,P5)
Player 2 ID, arrayPotentialOpponents (P1,P3)

My goal is to display all potential pairs in a new collection so it looks like:

P1 - P2 (with player names and images)
P1 - P4
P1 - P5
P2 - P1 (ok, this is redundant, will eliminate redudant pairs at the end)
P2 - P3

I don’t know how to transform my data structure from initial table into a new structure that contains pairs.

Is it possible to create a new column containing arrays of pair opponent IDs? This should be arrays of arrays column in Glide, if this is supported.
Even than, I need to create relation to main Players table to obtain player Name, photo etc which I don’t know it is possible from array or arrays column

Could we see a screenshot of the data? I have a pretty good idea how I would do it

sure, here is the playerID column screen shot containing playerIDs

and here is screen shot of the column that represents possible opponents list (array of other playerIDs)

These all RowIDs of players from Players table.

What’s the reason behind the repeating player Id’s in the Player ID column? Normally I’d expect to see a unique list of player ID’s

Player can play at different time slots
E.g Monday 7, Tuesday 9 etc

Therefore repetition

At each specific time slot, each player has a list of unique opponents

Ok and for the list you want to see every permutation with all players… or … you want to click on a player and on that players screen you see a list of all his matches

Because the ladder is the one I’m thinking of

Well there are different options:

  1. I want to display all possible pairs for a time slot listing time slots in a collection. Under each time slot in the collection, I want to display possible pairs (without redundant pairs)

  2. The second view is again pairs, but this time by players view. I want a list of all possible pairs regardless of time slot. Some pairs can play on different time slots. Also not redundant

Already have a click view.

When I click on player i see a list of his possible opponents but not in the pair view but inline list.

What i want is display a pair of players with their names and images as an item in collection

I tried this (very early draft), created just rich text component as a single component within custom collection. But the html look is not what I wanted (it breaks into 2nd column etc). I am aware I need to play more with CSS to achieve the desired look.

Just before I continue investing effort into CSS/html fine tunning - wanted to check if rich text component does not impose any limitations in terms of displaying html. You mentioned you used HTML table to keep the look under control.

Thanks for advice.

I don’t have an exhausted list of what the rich text component can not support, but Jeff and Darren have very good examples of what it can achieve in terms of table. Please beware that you should use inline CSS.

1 Like

If you share your HTML, some screenshots and explain what you want it to look like, then maybe we can see what needs to be adjusted.

The main things you can’t use in a rich text component are any form of javascript or header based CSS. As @ThinhDinh mentioned, inline CSS is possible though, so generally I don’t need to resort to using Glide’s implementation of CSS through the builder. I just build any CSS into the template column that builds the table.

1 Like

I achieved what I wanted with inline CSS and divs. Many thanks!

2 Likes