0

I'm using PowerApps to create a custom view form for a modern SharePoint list. I have a Gallery listing items related to the selected list item. Parent / child relationship works great, but I would like the first Gallery item to be selected by default.

This works maybe once the first time. Close (or hide) the view form, select a different list item and view details, first Gallery item (and no other items) are selected.

Does it work differently in SharePoint than stand-alone apps? Tried working with context variables but they seem to lag, they don't seem to get updated properly.

Screen1.OnStart = Clear(Collection1);

Screen1.OnVisible = UpdateContext({X:Gallery1.Selected.ID})

Screen1.OnHidden = Clear(Collection1);UpdateContext({X:Blank()})

Gallery1.Default = First(Collection1);

1
  • The trigger is probably the problem; OnVisible is just that, on visible, not to be confused with on all form elements successfully loaded... now that would be handy.
    – BDC604
    Commented Jun 5, 2018 at 3:16

1 Answer 1

0

On Gallery, Set your Default property to:

First(Self.AllItems)

Or

OnVisible Of Screen:

Set(var,First(galleryname.AllItems))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.