Hello, I have checkboxes placed in my gallery and a checkbox outside gallery that allows me to check all the check boxes that are from the gallery. now, If I uncheck any checkbox in gallery, it means that not all items from the gallery are selected and I want this to be reflected on the checkbox that is placed outside the gallery and uncheck it.
here is the formula I've written, I get circular reference error. How can I work around this -
Solved! Go to Solution.
// checkbox outside gallery
CheckAll.Default = ctxNoSingleUnchecked
CheckAll.OnCheck =
UpdateContext({ctxAllCheck: false});
UpdateContext({ctxAllCheck: true});
UpdateContext({ctxNoSingleUnchecked: true});
Reset(Gallery1);
CheckAll.OnUncheck=
UpdateContext({ctxAllCheck: true});
UpdateContext({ctxAllCheck: false});
UpdateContext({ctxNoSingleUnchecked: false});
Reset(Gallery1);
// checkbox inside gallery
CheckBox1.Default = ctxAllCheck
CheckBox1.OnCheck=
If(CountRows(Filter(Gallery1.AllItems, !Checkbox1.Value))=0, UpdateContext({ctxNoSingleUnchecked: true}) );
CheckBox1.OnUncheck=UpdateContext({ctxNoSingleUnchecked: false})
// checkbox outside gallery
CheckAll.Default = ctxNoSingleUnchecked
CheckAll.OnCheck =
UpdateContext({ctxAllCheck: false});
UpdateContext({ctxAllCheck: true});
UpdateContext({ctxNoSingleUnchecked: true});
Reset(Gallery1);
CheckAll.OnUncheck=
UpdateContext({ctxAllCheck: true});
UpdateContext({ctxAllCheck: false});
UpdateContext({ctxNoSingleUnchecked: false});
Reset(Gallery1);
// checkbox inside gallery
CheckBox1.Default = ctxAllCheck
CheckBox1.OnCheck=
If(CountRows(Filter(Gallery1.AllItems, !Checkbox1.Value))=0, UpdateContext({ctxNoSingleUnchecked: true}) );
CheckBox1.OnUncheck=UpdateContext({ctxNoSingleUnchecked: false})
@Alex_10 Thanks, The only thing which I do not understand here is
CheckAll.OnCheck =
UpdateContext({ctxAllCheck: false});
UpdateContext({ctxAllCheck: true});
CheckAll.OnUncheck=
UpdateContext({ctxAllCheck: true});
UpdateContext({ctxAllCheck: false});
Why are we making it false and then true on check and why are we making it true and then false onuncheck?
I think it also refreshes the ctxAllCheck that is been applied on the items of gallery.
this is for the case:
when you check all first and then uncheck any checkbox in the gallery and after want to check all again by pressing checkbox outside.
you may test it with the following code to see what happens in the case i described (basically the logic will not work properly):
CheckAll.OnCheck =
UpdateContext({ctxAllCheck: true});
CheckAll.OnUncheck=
UpdateContext({ctxAllCheck: false});
User | Count |
---|---|
263 | |
110 | |
98 | |
55 | |
40 |