Suggestion T13384
Visible to All Users

Hide all questions by default

created 2 years ago

Hello SurveyJs Team,

I want to hide all questions by default, to make the user choose the question he wants to display.

Kind Regards,
Amro

Answers approved by surveyjs Support

created 2 years ago (modified 2 years ago)

Hello,

I've added the visPanel.hideAllElements(); and visPanel.showAllElements(); functions via the https://github.com/surveyjs/survey-analytics/commit/7c470286dfe8bb5da132bedbeaefc1873fda7144 commit.
This functionality will be available in the nearest minor update most likely next Wednesday.

Thanks, Serge
SurveyJS Team

    Comments (2)

      @Amro,
      v1.9.92 is already available. Please feel free to upgrade and verify how well the new API meets your requirements.

      Thank you

        Hello,

        I created a separate ticket on your behalf: T13507: Question Selector Dropdown appears incorrectly when question names are long. We placed it in our processing queue and will process it shortly.

        created 2 years ago

        Hi Amro,
        If you'd like to hide questions in the SurveyJS Dashboard, you can follow these steps:

        1. Subscribe to the onAfterRender event of a VisualizationPanel object. This event is triggered after the dashboard has finished rendering.

        2. In the event handler, use the hideElement(questionName) function of the panel to hide the corresponding chart. Pass the question name as the argument to hideElement to specify which chart should be hidden.

        3. Enable the showToolbar option of the dashboard to allow users to select a question from a drop-down menu in the toolbar.

        Here's an example code snippet demonstrating how to achieve this:

        JavaScript
        vizPanel.showToolbar = true; ... function hideCharts(panel) { survey.getAllQuestions().forEach((element) => { panel.hideElement(element.name); }); } vizPanel.onAfterRender.add((sender, options) => { hideCharts(sender); });

        View Demo

        Please note that the hideElement function is part of a private API, which means it may be subject to change without notification in future updates of SurveyJS. Therefore, it's important to be aware of potential compatibility issues when using this function.

        You can view a live demo of this implementation in the CodeSandbox demo.

        Feel free to reach out if you have any further questions or need additional assistance.

          Show previous comments (4)

            Hi Jane, Many thanks.

            Well i think this's not an effective method because I have many surveys and many questions,

            If I use this way, the dashboard for each survey will clash.

              Hello Amro,
              Please let me discuss this task with the team. I'll get back to you shortly.

              Thanks

                Hello Amro,
                I noted down your inquiry and forwarded to our developers for further consideration: https://github.com/surveyjs/survey-analytics/issues/346.

                Please look forward to our updates.