cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
patrick1992
Level: Powered On

Set a specific child Gallery to invisible

I have a gallery called 'gallery_groups' that displays a label called 'group_name' from the collection, 'coll_groups'.

 

Theres a sub gallery in the 'gallery_tasks' called gallery_tasks that displays checkboxes called 'ck_tasks' from the collection, 'coll_tasks'.

 

Capture.PNG

 

 

What I want to happen is when the user selects the label 'group_name' the 'gallery_tasks' visible property is set to true or false and only displays the 'ck_tasks' that that belong to a particular group_name.

 

I have tried tying the 'gallery_tasks' visible property to local variable and change it to true or false when the 'group_name' is selected but that will set all the 'ck_tasks' to visible or invisible instead of the ones that belong to their groups.

 

Any ideas or workarounds?

1 ACCEPTED SOLUTION

Accepted Solutions
patrick1992
Level: Powered On

Re: Set a specific child Gallery to invisible

I was able to find a solution.

 

For the screen's OnVisible property create two variables that hold a number that will be the height of the task box and boolean that will tell if the task is visible.

 

UpdateContext({var_taskViz:false});
UpdateContext({var_ckTaskHeight:70})

-----------------------------------------------------------------------------------------------------------------

Then go to TemplateSize of the gallery_tasks and give it this function.

 

 

If(var_taskViz && ThisItem.IsSelected,var_ckTaskHeigh,0)

 

 

 

-----------------------------------------------------------------------------------------------------------------

Then go to the height property of the gallery_tasks and set its value to below function.

 

 

CountRows(Filter(coll_tasks_lookup,ThisItem.task_group_id=task_group_id))*Gallery_tasks_1.TemplateHeight

 

 

 

This will filter the collection that holds the tasks and find the ones that belong to the selected group and count how many tasks are in this group and multiply it by the templateHeight of the gallery_tasks.

 

-----------------------------------------------------------------------------------------------------------------

 

Now on the the label that holds the group name add below function to its onSelect property

 

If(var_taskViz=false,

UpdateContext({var_taskViz:true});

//var_groupSelected is used to check if your opening or closing a group
UpdateContext({var_groupSelected:ThisItem.task_group_id}),

//if var_taskViz is true and the var_groupSelected and ThisItem.task_group_id match then it will close the group
var_taskViz && var_groupSelected=ThisItem.task_group_id,
UpdateContext({var_taskViz:false});
UpdateContext({var_groupSelected:ThisItem.task_group_id}),

//If the group_id doesn't match it means that you have selected a different group while another one is open
//So then what will happen is the opened group will close and selected group will open
UpdateContext({var_taskViz:false});
UpdateContext({var_taskViz:true});
UpdateContext({var_groupSelected:ThisItem.task_group_id}) )

 

 

 

2 REPLIES 2
Community Support Team
Community Support Team

Re: Set a specific child Gallery to invisible

Hi @patrick1992,

 

Have you tried to filter the gallery_tasks to only show tasks associated to the Group name?

If the task collection contains the proper group ifnormation, then we could use the Gallery_groups.Selected.Groupinfo to filter the task collection.

Which should make the collection to only show the tasks associated with the group.

 

For example:

Under the Gallery_task gallery, with the items property, we could filter it as below:

Filter(coll_tasks, GroupField=gallery_groups.Selected.GroupField)

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
patrick1992
Level: Powered On

Re: Set a specific child Gallery to invisible

I was able to find a solution.

 

For the screen's OnVisible property create two variables that hold a number that will be the height of the task box and boolean that will tell if the task is visible.

 

UpdateContext({var_taskViz:false});
UpdateContext({var_ckTaskHeight:70})

-----------------------------------------------------------------------------------------------------------------

Then go to TemplateSize of the gallery_tasks and give it this function.

 

 

If(var_taskViz && ThisItem.IsSelected,var_ckTaskHeigh,0)

 

 

 

-----------------------------------------------------------------------------------------------------------------

Then go to the height property of the gallery_tasks and set its value to below function.

 

 

CountRows(Filter(coll_tasks_lookup,ThisItem.task_group_id=task_group_id))*Gallery_tasks_1.TemplateHeight

 

 

 

This will filter the collection that holds the tasks and find the ones that belong to the selected group and count how many tasks are in this group and multiply it by the templateHeight of the gallery_tasks.

 

-----------------------------------------------------------------------------------------------------------------

 

Now on the the label that holds the group name add below function to its onSelect property

 

If(var_taskViz=false,

UpdateContext({var_taskViz:true});

//var_groupSelected is used to check if your opening or closing a group
UpdateContext({var_groupSelected:ThisItem.task_group_id}),

//if var_taskViz is true and the var_groupSelected and ThisItem.task_group_id match then it will close the group
var_taskViz && var_groupSelected=ThisItem.task_group_id,
UpdateContext({var_taskViz:false});
UpdateContext({var_groupSelected:ThisItem.task_group_id}),

//If the group_id doesn't match it means that you have selected a different group while another one is open
//So then what will happen is the opened group will close and selected group will open
UpdateContext({var_taskViz:false});
UpdateContext({var_taskViz:true});
UpdateContext({var_groupSelected:ThisItem.task_group_id}) )

 

 

 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 49 members 4,172 guests
Please welcome our newest community members: