[Question]: Nav does not update the SelectedKey before firing OnSelect #377
-
Describe the bug To Reproduce
Expected behavior Actual behavior |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thanks for reporting this @ghurlman. Nav has been implemented in a way that is intended to bind a variable in Power Apps to the Nav.SelectedKey property. This enables a way to set a default value to display on first load state (e.g., the first item in the Nav on app load, display the current page of the app). This can be done by:
At this point, the notification should be showing you the current value of Is this acceptable? I realize it might not reflect the way in-product components are implemented, however it is consistent with how Creator Kit controls have been implemented. If so, we can update documentation to make these steps clearer. |
Beta Was this translation helpful? Give feedback.
Thanks for reporting this @ghurlman.
Nav has been implemented in a way that is intended to bind a variable in Power Apps to the Nav.SelectedKey property. This enables a way to set a default value to display on first load state (e.g., the first item in the Nav on app load, display the current page of the app).
This can be done by:
varSelectedKey
to the desired record (e.g., in App.OnStart):Set(varSelectedKey, First(NavItems).ItemKey);
varSelectedKey
varSelectedKey
in Nav.OnChange:Set(varSelectedKey, Self.Selected.ItemKey); Notify(varSelectedKey);
At this point, the notification should be showing you the current value of
varSelectedKey
.I…