Set visibility of Views

Description of the limitation and why it is relevant to address

As a deveIoper want to set up an application where views can be made visible/invisible based on certain logic so that users can be guided much better and have a better experience.

I think this is relevant for the VIKTOR platform because it improves adoption for users due to good user experience.

Submitter proposed design (optional)

A visible argument on the View decorator.

Current workarounds

None

Requested by

@Bayo

Thank you @mslootweg
Voted!

Hi Marcel

I hope you are well.
Do you know if there is a way to lock the zoom of a PDF in PDFView and also remove the download function? I am busy building an application for a research institution, and it would be great if we had the option to prevent the downloading of IP-protected files and zoom into the document as much as possible so it can only be viewed online.
Thanks.

I believe this is not possible. But I think there should be ways of presenting this by leveraging the flexibility of the WebView.

Hi Marcel

Thanks for the response. I meant to send this as a direct message to you.
Thanks for the direction.
I’ll look into it.

Another proposal; such code would allow for view visibility per step

def _get_views(params, **kwargs):
    if params.step_1.verdeling:
        return ["View A"]
    return []

Parametrization:
    step_1 = Step(... views=_get_views)
1 Like

We have started the development on this feature!

View visibility has been released in the latest SDK 14.22.0 :partying_face:

enabling you to dynamically switch the visibility of the view, in a similar way as how you could already do this for fields:

def get_visibility(params, **kwargs):
    return params.param_x
    
    
class Controller(vkt.Controller):
    ...
    
    @vkt.TableView("Results", visible=get_visibility)
    def my_table_view(self, params, **kwargs):
        ...

more info can be found in the docs:

Curious if you like it @Bayo, @Wichard, @Daniel, @Enrique, @TH-MDR, @Rutger, @rkg, @BElsinga, @wouterhouzr, @SolalSPC, @ThomasN, @marliesbuijs, @Floris, @AnneOffermans, @leomalet, @MSEP, @pieter.bieghs, @Fanny,

6 Likes

Very glad to have this option :partying_face:

2 Likes