Skip to content

[Question]: Nav does not update the SelectedKey before firing OnSelect #377

Answered by denise-msft
ghurlman asked this question in Q&A
Discussion options

You must be logged in to vote

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:

  • Initializing varSelectedKey to the desired record (e.g., in App.OnStart): Set(varSelectedKey, First(NavItems).ItemKey);
  • Setting Nav.SelectedKey to varSelectedKey
  • Updating 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…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by denise-msft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
❔question Issue is a question that requires an answer, not changes to code. 👋 needs author feedback Waiting on a response from the author Component: Nav
2 participants
Converted from issue

This discussion was converted from issue #337 on August 01, 2023 01:10.