Do you have any good suggestion to navigate between items and invoke them outside the component, from a button for example.
Thanks
Hi @FullStackRafik, I'm afraid I'm not sure what you're asking. Could you provide more detail, or ideally a CodePen that illustrates what you're trying to accomplish? Thanks!
Hey @FullStackRafik, this question may be better fielded on the SharePoint Developer Documentation repository: https://github.com/SharePoint/sp-dev-docs/issues since it involves webparts and routing.
@kkjeer : Here is what I want to do:
DetailsList component and button, I need when I click button I can navigate between the items of the DetailsList.
@KevinTCoughlin : It's not related to Webpart and routing(please forget about that), it's related to the Fabric UI DetailList component and if there is a property that can set the current index like for example "initialFocusedIndex".
I updated the question to be more simple.
@FullStackRafik, if you need to programmatically set selection similar to initialFocusedIndex (I'm assuming given your response above) then you'll need to look at the selection?: ISelection prop of DetailsList:
The ISelection interface allows one to programmatically set, toggle, clear selection among other things.
@KevinTCoughlin
Butr this method doesn't trigger "_onItemInvoked".
@KevinTCoughlin
Butr this method doesn't trigger "_onItemInvoked".
_onItemInvoked is only invoked on keyboard event as per its doc comment:
Since you're programmatically controlling selection, can you also programmatically invoke _onItemInvoked or whichever method you need?
I resolved my issues, now I can navigation between items by clicking a button (up and down), and I triggered programmatically _onItemInvoked method.
@FullStackRafik glad to hear it! If you don't have any other questions, please feel free to close this issue. Thanks!
Most helpful comment
Hey @FullStackRafik, this question may be better fielded on the SharePoint Developer Documentation repository: https://github.com/SharePoint/sp-dev-docs/issues since it involves webparts and routing.