Is there a way to change the libary view using a java script?

Hello,

I hope you can help me.
Is there a way to change the view using a java script?
That is, under certain conditions, "Only me" is no longer selected in the view, but "All Documents"?
image

Best regards
Corinna

Hello @Sternchen,

List or Library control doesn't support programmatic change of the list view.

Is there another way to change the view under certain conditions?

@Sternchen,

You can multiple List or Library controls and show/hide them with JavaScript depending on certain conditions.

This sounds like a good idea.
seems like it´s working. thanks for the idea.

Hi,
I would like to change the view programmatically as well. In the user guide it says it is possible, but It does not work for me.
https://plumsail.com/docs/forms-sp/designer/controls/list-or-library.html#change-view
If I console log the view name it does say the new view name, but the list control does not change. Should this work now? I tried to refresh the control as well.
I am on SharePoint 2019 on-remise

Hello @Janos_Nagy,

View changes are currently only available for SharePoint Online. In the On-Premises version, you can add multiple List or Library controls, each showing a different list view, and then display them conditionally.