Question T9396
Visible to All Users

Survey Creator V2: How to focus on the first question after loading a survey

created 3 years ago

So i got this working for loading a saved survey

JavaScript
const localStorageName = "SaveLoadSurveyCreatorExample"; const savedFile = window.localStorage.getItem(localStorageName); if (savedFile !== null){ const savedData = JSON.parse(savedFile); creator.JSON = savedData; }

How can I get the survey creator to focus on the first loaded question? Because right now the focus is on the design surface and the property grid shows the property of the survey itself.

I want the property grid to show the property of the first loaded question.

Answers approved by surveyjs Support

created 3 years ago (modified 3 years ago)

Hello Taher,
Please add the following code after assigning the JSON:

JavaScript
const questions = creator.survey.getAllQuestions(); if(questions.length > 0) { creator.selectElement(questions[0]); }

Thank you,
Andrew
SurveyJS Team