Hi,
I have implemented nested gallery concept in Canvas PowerApps.
1. I have checkbox (Select All) added on my parent gallery
2. I have checkbox (Select single) added on my child gallery
3. I have passed "Parent_checkbox.value" to Default property of "Child_checkbox"
4. When I select "Parent_checkbox" then automatically it selects all "Child_checkbox"
5. When I uncheck "Parent_checkbox" then automatically it uncheck all "Child_checkbox"
Till here it is working as expected.
Now, when I will uncheck any one of the "Child_checkbox" then it should uncheck it's "Parent_checkbox".
I tried many ways to implement it but it is not working.
Did you get any solution?
I did find some behavior that wasn't right, namely that when one of the child checks was unchecked, it would uncheck all of them. Odd that it was not the same as what you found. I updated my solution but there it's still not quite right as all parent gallery rows reset at the same time.
Not working
Yes. I have it but instead of lblID.Text=ThisItem.ID I am taking lblID.Text=ThisItem.country as a unique identifier
Also do you have lblID with Text=ThisItem.ID in ParentGallery?
In my tests it did all that. Try Reset(Child_checkbox) at the end of both Parent_checkbox.OnUncheck and Parent_checkbox.OnCheck
Thanks for sharing the solution.
I have implemented your solution and it is working to check/uncheck parent checkbox based on selection of child checkbox. Below things stopped working now:
1. When check parent checkbox all child checkboxes should be checked
2. When uncheck parent checkbox all child checkboxes should be unchecked
So the solution which you have provided, it should work along with above 2 points. I am trying to fix the problem.
Please let me know if you get any solution to fix it.
Thanks for providing a solution. I will try it and let you know.
My Solution from a few minutes ago follows this same concept, combined with the other solution you had referenced and a little improvement of my own.
First, add a label called lblID to your parent gallery, and make sure its Text property is set to ThisItem.ID (or whatever unique identifier for the record). Possibly set its Visible property to false if desired.
Screen.OnVisible:
Collect(
MyChecks,
{
ID: -1,
Value: false
}
);
Clear(MyChecks)
Parent_checkBox.OnCheck:
UpdateContext({Resetting:true});
With({
MyCheck: LookUp(
MyChecks,
ID = ThisItem.ID
)
},
Patch(
MyChecks,
MyCheck,
{
ID:ThisItem.ID,
Value:true
}
)
);
UpdateContext({Resetting:false})
Parent_checkbox.OnUncheck:
UpdateContext({Resetting:true});
With({
MyCheck: LookUp(
MyChecks,
ID = ThisItem.ID
)
},
Patch(
MyChecks,
MyCheck,
{
ID:ThisItem.ID,
Value:false
}
)
);
UpdateContext({Resetting:false})
Parent_checkbox.Default:
!(false in Concat(ChildGallery.AllItems,Child_checkbox.Value))
// substitute your child gallery name
Child_checkbox.OnUncheck:
Reset(Parent_checkbox)
Child_checkbox.Default:
With({
MyID:Value(lblID.Text)
},
LookUp(
MyChecks,
ID = MyID,
Value
)
)
Child_checkbox.Reset:
Resetting
WarrenBelz
146,786
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,093
Most Valuable Professional