Show container when other container is not visible/hidden

Hi,

In a grid system that displays data based on a search box, I have a column with two containers inside. The first container is bound by a formula to show when it meets certain requirements. However, I am unable to bind the second container to any conditions. Therefore, I want to bind its visibility to the other container in the same row.

Unfortunately, I’m struggling to find a way to accomplish this.

Could you show a screenshot ? What do you mean by you are unable to bind the second container ? You can’t click on the binding button ? The Binding popup doesn’t show up ?

If you think you have a bug please report it on support.weweb.io :slight_smile:

Hi @Alexis ,

I don’t think it’s a bug in weweb. I think it’s more my non skills in doing what I want and my incapability to explain myself properly.

But let me try to explain it again…

I have a list with items and I succeed to bind a container when the list met the requirements set.

But what I am not able to figure out is… when list is empty, I want to show a different container instead of it showing ‘Empty List’. So the question is, how can I display an object, like a container, when list is empty?

Hopefully, I this time am able to explain the situation a bit better.

Thank you.

No worries!
How did you bind your list so it appear only when the requirement are met ?

You will need to improve the condition so the list doesn’t appear when its empty. You can use the “if” and “length” formulas and bind it to the display or the conditional rendering condition

And you can do the same for the other container but reverse true and false.

Hello Alexis,

Thank you for your answer. And yes, your answer displays the data of the results. I am also able to create this part.

But I want to display a container when the list is empty and am not able to do it. I have tested your reverse method, but it still only displays ‘Empty List’, instead of the container I want to display when list is empty.

Is there something I can do, that when list is empty, it displays a text, container or information I want to show people?

Thank you!

Do it step by step.

Try just to bind “False” to the conditional rendering of your first container, and “True” to the conditional rendering of your second container.

Do your first container disappear and the second one show up ?

If not, you may have a bug. If yes, you may struggle to create the right formula. Could you share with me what you’re trying to bind to the condition of the Conditional Rendering section please ?

First of all, I want to thank you for your patience and time.

But okay, I have taken some screenshots. Hopefully, these could give you a better impression of what I am trying to do.

1. Users can search for the team they want to join on the following page.

Screenshot 2023-07-19 at 23.57.40

2. This is set up in a grid format, which looks like this.

Screenshot 2023-07-19 at 23.56.33

**3. Users will see a list of teams with the team name and image when searching for a team. In the end, they can see whether they have already sent a request. If they haven’t sent a request before, I want to show a button (in a container) where users can send a request to join. Now it only shows an ‘Empty list’ in the editor and a blank on the front end. **


4. The last column is linked to a table where all requests are stored by team and user.

Screenshot 2023-07-19 at 23.41.53

5. I want to show this when users haven’t sent a request yet to that particular team.

Screenshot 2023-07-19 at 23.43.35

I have tried your recommendation with several combinations, but this is my result.




I still don’t think it’s a bug; it’s probably due to my lack of skills and knowledge that I can’t achieve the desired result. So hopefully, your insight could guide me in the right direction.

Thank you.

I’m not sure why you’re trying to use a collection list on your last column ?

You should use a text or a button I think :thinking:

Then you need to be able to know if a given team has already be requested by your user. I don’t know how your data is formatted so I can’t help you more.

But probably, once you replace your collection list with a text or a button, you can bind the display of the element with a formula looking like :

// For your request sent text
if(length(filterByKey(AllJoinRequests, 'teamid', item.teamId)), true, false)

// For your request to join text
if(length(filterByKey(AllJoinRequests, 'teamid', item.teamId)), false, true)
1 Like

Thank you very much! That is the solution.

Regarding me trying to use a collection list in my last column, is me displaying my lack of skills or knowledge. :sweat_smile:

I have another question: What if a user is already a team member, and I want to display the text ‘joined.’ How can I make this possible?

No worries, we all start somewhere :slight_smile:

If you have the list of members inside every team item you can do something like that

if(length(filterByKey(item.members, 'userId', myUser.id)), true, false)

Hope it make sense :slight_smile:

1 Like

Thank you! :pray::pray::pray: