I customized a SharePoint list item with Powerapps.
Once published, I noticed that when you double-click on a list item, the item data don't show up immediately in the form fields but only after a few seconds or miliseconds (which means that if you jump from one list item to another, you see the previous item data for a few seconds -> not very nice).
Anyone knows a way to detect when the data for the selected item has indeed been loaded ?
Is there a way to clear all fields in the form every time the form is shown (so it looks empty while it loads the item's data) ?
The SharePoint List form is using a way to determine whether the data has been loaded by the method below (Under the Item property of the Form control):
If(IsBlank(SharePointIntegration.Selected) || IsEmpty(SharePointIntegration.Selected),First(List1),SharePointIntegration.Selected)
The default loading experiences from my side for the View Form is as below:
And as the Formmode is Formmode.New, the SubmitForm and ReSetForm would have no effects.
So there is no way based on what I know, to clear those fields before loading for another item.
As you can see on your GIF, there is a small latency on the form before the values of the preivous edited item are replaced by the ones ffrom the selected item.
When the OnEdit event of the SharePointIntegration object or the OnVisible event of the screen are triggered they hold the values of the previous item, not the real selected one (at least for a few milliseconds).
Is there any wa around this ?
There really should be some signal or event that says the form is ready, the correct data is now loaded into the form.
Now I need to have a timer wait before doing something, but I don't really know how long.
I fully agree, this is the only missing link I have for creating an inline repeating section in my form. Since this repeating section works with a collection, I need a point to convert a field value to a collection (by splitting strings e.g.). I'm able so do this in an OnSelect of a button, but ideally I want this to happen automatically when the ListItem is loaded... That few milliseconds delay doesn't help 😉
I've put up the following workaround for now:
SharePointIntegration.SelectedListItemID = Value(DataCardValue5.Text)
...providing DataCardValue5 is the one for the ID field datacard...
@R3dKap solution works great for hiding and showing things, but I need a trigger point to trigger a conversion from a string value to a collection, to get a repeating-section like behavior.
@michelsmpit you could put the formula I mentionned above ( SharePointIntegration.SelectedListItemID = Value(DataCardValue5.Text) ) into the Default property of a toggle control and then place your conversion formula inside the toggle's OnCheck property... What do you think?