cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rprahalad
Helper V
Helper V

How do I drop a Gallery Column at run time?

I have a gallery with about 15 columns. By default I show about 8 columns. I have a Show/Hide Columns button which when clicked, I pop a Pop-up out listing out the 15 fields with Checkboxes. next to it. I was just wondering how I can hide the entire column if a user unchecks that field? 

 

Meaning, the columns  that need to be shown should need to keep shifting left, so that I don't leave any gapes between two columns. Should I set the width property to 0 of all the Header and controls if they Hide  a column? Or are there any other ideas?

 

Thanks!

2 ACCEPTED SOLUTIONS

Accepted Solutions
R3dKap
Super User
Super User

Hi @rprahalad,

There is a better solution for your need: use the automatic layout containers:

R3dKap_0-1621161707923.png

 

These containers have the advantage of automatically align their content to the left, right, top or bottom (according to what you choose). Meaning that if inside an horizontal container your put 5 labels (column headers for instance) and hide the 3rd one, the 4th and 5th labels will automatically shift to the left.

I use these containers all the time now to organize all the controls on the screen of my apps.

View solution in original post

Brilliant! Never thought of that, @R3dKap ! I can't wait to try it out. Appreciate your response. I just had one question. I have already designed around 15 screens. Since the users will ONLY be using their laptops (and not Tablets). I have the Auto Fit turned on so that I get the full screen and we really don't care about it being responsive. But here it makes total sense to use containers. 

 

Would I need to turn that off for the containers to work?  Thanks again!

View solution in original post

6 REPLIES 6
vermaaman
Helper II
Helper II

Not sure if i have understood the question completely but my suggestion would be like - 

 

1 - Create a variable and change the variable value to true/false on Oncheck/Uncheck property and that you pass in control's Visible property so that will show and hide.

2 - To shift the column when you hide the columns in gallery you need to store the value of Position X of the previous column control in a variable, then set the value to the next column using a variable.

I am afraid if there is any straight way out to shift the columns when you hide one.

Hi @vermaaman ,

 

Many thanks for your response! Yes, you have understood it perfectly:-). I already implemented the variable/checkbox hiding the controls part of it. But it is leaving gaps between the columns. 

 

But like you said, i was not sure if I had to chase down the Width of all the controls in that hidden column and set it to 0 or if I have to reset the X's. Or if there is any way to do at the collection level (Show/Drop Columns).

 

But I shall implement your way tomorrow and update this thread! Thanks again. 

R3dKap
Super User
Super User

Hi @rprahalad,

There is a better solution for your need: use the automatic layout containers:

R3dKap_0-1621161707923.png

 

These containers have the advantage of automatically align their content to the left, right, top or bottom (according to what you choose). Meaning that if inside an horizontal container your put 5 labels (column headers for instance) and hide the 3rd one, the 4th and 5th labels will automatically shift to the left.

I use these containers all the time now to organize all the controls on the screen of my apps.

View solution in original post

Brilliant! Never thought of that, @R3dKap ! I can't wait to try it out. Appreciate your response. I just had one question. I have already designed around 15 screens. Since the users will ONLY be using their laptops (and not Tablets). I have the Auto Fit turned on so that I get the full screen and we really don't care about it being responsive. But here it makes total sense to use containers. 

 

Would I need to turn that off for the containers to work?  Thanks again!

View solution in original post

R3dKap
Super User
Super User

If you don't need your app to be responsive, there is no need to change your Scale to fit option on your app. Just use the layout containers as is.

Notice though, that converting your whole app to using layout containers might be heavy work. Better to do it from the start... 😉

Ha Ha. Yes. It was lot of hard work building these screens as we had no idea about PowerApps 4 weeks ago.  Glad I can still use containers without having to mess with any settings. :-). Thanks!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,738)