Question T19033
Visible to All Users

Show a property grid as a separate or modal tab

created 6 months ago (modified 6 months ago)

[Ticket cloned from T19032: I am trying to find a property to manage multiple takes on survey.]

Thanks I am able to find it.

Is it possible to show propertygrid as a separate tab or in a modal?


From: support=surveyjs.io@mg.surveyjs.io <support=surveyjs.io@mg.surveyjs.io> on behalf of Jane [surveyjs Support] <support@surveyjs.io> Sent: Wednesday, July 17, 2024 12:58 PM To: Humair Quadri <humar.quadri@thesiscloud.com> Subject: RE: I am trying to find a property to manage multiple takes on survey. [T19032]

Comments (2)

    Hello,
    Unfortunately, a property grid doesn't offer such an option. However, take mote that users can expand and collapse a property grid. Also, it's possible to use a size grip to expand the property panel's width.

    Let me know if this option might help.

      I am able to find it.

      There is a problem I am facing with custom properties.

      For example I added a property with default value of true, when I uncheck I get the setValue called but when I check it again I dont get setValue called.  and the property is removed from json.

      I am trying to link this cookiename property to this checkbox. And I am able to set a value when I uncheck my property but not able remove cookiename when I am checking again.

      JavaScript
      Serializer.addProperty("survey", {     name: "allowmultipleresponses",     displayName:"Allow multiple responses",     category: "general",     visibleIndex: 3,     isRequired: true,     type: "boolean",     default: true,     onModified:(className,property) \=\>{       alert(property);     },     onSetValue: (survey, value) \=\> {         // ...         // You can perform required checks or modify the \`value\` here         // ...         // Set the \`value\`         if(value) {           survey.setPropertyValue("cookieName", "");         } else {           survey.setPropertyValue("cookieName", "single\-response");         }         // You can perform required actions after the \`value\` is set         // ...     } });

      Answers approved by surveyjs Support

      created 6 months ago

      Hello,
      SurveyJS Creator does not serialize default property values to a survey JSON. Otherwise, the resultant survey JSON definition would be a large JSON object. If the value specified matches the default property value, the property is not saved to the survey JSON definition. When a survey is loaded, it uses default property values.
      From what I gather, you wish to create a custom property which would check/uncheck the survey.cookieName setting. To achieve this, handle the onSetValue function as follows:

      JavaScript
      Serializer.addProperty("survey", {     name: "allowmultipleresponses",     displayName:"Allow multiple responses",     category: "general",     visibleIndex: 3,     isRequired: true,     type: "boolean",     default: true, onSetValue: (surveyElement, newValue) => { surveyElement.setPropertyValue('allowmultipleresponses', newValue); const cookieName = newValue ? "userId" : ""; surveyElement.setPropertyValue('cookieName', cookieName); } });

      The onSetValue function will be invoked when a user checks/unchecks an option.
      Thus, since you set the default allowmultipleresponses property value to true, you would require to also override the default cookieName property value from code.

      JavaScript
      Serializer.getProperty('survey', 'cookieName').defaultValue = "userId0";

      I hope this information helps. Please let me know if you have more questions.