microsoft / powercat-creator-kit

This toolkit helps create well-designed Power App experiences on the web & mobile. It contains a component library; PCF controls and other utilities that increase developer productivity.
MIT License
312 stars 51 forks source link

[BUG]: Set Default Item for Nav Control #396

Closed sperry1625 closed 4 weeks ago

sperry1625 commented 1 year ago

Describe the bug Cannot select a default item for a Nav control.

To Reproduce Steps to reproduce the behavior:

  1. Add Nav control to screen
  2. Create variable to use for SelectedKey property (ex. ctxSelKey)
  3. Set Nav control SelectedKey property to variable, ctxSelKey
  4. Set variable, ctxSelKey, to default key value

Expected behavior With SelectedKey variable set to a default key, when Nav is shown the Item with the Key value = to the SelectedKey value will be selected. If this is not how this is supposed to work, please provide an example showing how to set the default selection in a Nav control.

Screenshots N/A

Additional context I tried creating an InputEvent for SetFocus, SetFocusOnRowSetSelection and SetSelection. The documentation only shows that the Nav Control supports the SetFocus InputEvent. None of these worked.

AB#951

sperry1625 commented 1 year ago

I was able to figure out the issue. The problem with the Nav control is the ItemKey must be Text. It cannot be numeric. I would still classify this as a bug because keys are usually numeric for performance reasons.

Is this working by design?

denise-msft commented 1 year ago

Thanks for following up @sperry1625, we'll update documentation to make this clear. It is by design, the component looks for a specific data type, however the platform doesn't seem to give a good error message that lets you know it's not working. I'll log this as internal feedback as well so the team is awar.