Hi all,
I have a gallery with checkbox in all rows. I have a checkbox to select all items outside gallery too. I try to insert in the default property in the checkbox: checkboxselectedall.value, so if I click on the checkbox it selected all rows.
I have a filter outside gallery (for example to select only row in the gallery that are man), I would like to filter man and then I want to click on checkboxselectedall and select only row with man.
Do you have an idea?
Thank you
Solved! Go to Solution.
For the first error, can I ask you to check the "Default" property of the checkboxes? The default value should be "ThisItem.Selected".
As for the second error, I'm not quite sure what exactly produce this result. Your "ClearCollect()" does create the column with a "false" value though, so it's quite unclear why it would behave this way. I'll need to do some experiments on my side to try and replicate the situation.
Hello @common_user ,
My suggestion is updating the collection when you click on the checkbox.
First, you have to link the checkbox inside the gallery to a new "Selected" property of the item. "Selected" should be a new temporary column you add to the collection with "AddColumn()".
ClearCollect(collection, AddColumns(list, "Selected", false))
Then, in the "OnSelect" of your "SelectAll" checkbox, you update the collection with a new value to "Selected".
UpdateIf(collection;true;{Selected:Self.Value})
Finally, you update the list with the following code:
Patch(list,
Filter(Gallery.AllItems, Selected).ID,
{...}
)
Don't forget to update the record when you select the checkbox inside the gallery, in case you want to select a few records:
Patch(collection, ThisItem, {Selected:Self.Value})
Can you try and see if it works?
Hi @WiZey , thank you for your answer.
I try your solution, I insert the follow formula in the OnSelect property in the createCollection button.
ClearCollect(collection, AddColumns(list, "Selected", false))
I insert the follow formula in the OnSelect property in the selectAll checkbox
UpdateIf(collection;true;{Selected:Self.Value})
In the follow picture you can see on the left the filtered collection, on the right the full collection, I expect that only ID=1001 is true but you can see that all rows are true on the right collection, I think that it don't work, can you help me more please?
From your screenshot I can see "Select All" was checked, which indeed have updated the whole collection to "Selected = true".
Sorry for the silly question, but have you tried unchecking "Select All" to see if all records turn to "false"?
Yes @WiZey , it works.
The patch function don't works, I try Selected.ID too but I have the same error.
Can you help me?
Sorry, that was my bad.
Try with this code, it's a bit optimized and should do proper work:
With({selectedItems:Filter(Gallery3_6.AllItems;Selected};
Patch(TEST_RUOLI;
ShowColumns(selectedItems;"ID");
ForAll(selectedItems;{Selezione: Dropdown3_4.Selected})
)
)
Hi @WiZey ,
just a question, I think that now it works so I want ask you:
1. In the gallery need I to show the collection or the SP_list?
2. How can I reload the gallery? (it was connected to the collection)
Thank you
The gallery should show the collection. You rarely work directly on a SharePoint list unless you need live updates of your records.
To reload the gallery, you need to refresh the collection with "ClearCollect()" from a refresh button. "ClearCollect()" works similarly to "Collect()".
Thank you dear @WiZey, it's clear, I insert ClearCollect function in the SaveButton as follow.
With({selectedItems:Filter(Gallery3_6.AllItems;Selected)};
Patch(TEST_RUOLI;
ShowColumns(selectedItems;"ID");
ForAll(selectedItems;{Selezione: Dropdown4_10.Selected})
)
);;
ClearCollect(collection; AddColumns(TEST_RUOLI; "Selected"; false))
I have last two question.
1. How can I do if I want to select the record with the checkbox inside the gallery and then choose the value by dropdown (outside gallery) and patch the selected records?
2. I insert an icon in the all rows in the gallery and insert in the OnSelect property this code:
Select(Parent);;Navigate(DetailScreen)
How can I show in the DetailScreen a specific record? If I connect my gallery to SP_LIST I use in the detail screen a modify form with Gallery.Selected but it don't work if I have a collection in the gallery.
Thank you @WiZey for your support
Ok @WiZey I solved the second point with this formula in the Item property
LookUp(TEST_RUOLI; ID=Gallery3_6.Selected.ID)
User | Count |
---|---|
125 | |
87 | |
86 | |
75 | |
69 |
User | Count |
---|---|
216 | |
181 | |
140 | |
97 | |
83 |