Question T3055
Visible to All Users

Add and remove Property

created 5 years ago

Hi,

I would like to implement something very similar to what is described in Question T2458. So I copied the code from the plunker,
but adding "isComposite" as custom property to the panel question is not working out for me.

In fact, it seems to me that these commands are not working:
Survey.Serializer.addProperty("question", "myPropertyName");
Survey.Serializer.removeProperty("question", "description");
Survey.Serializer.findProperty("question", "description").visible = false;

Thank you for your support!

Answers approved by surveyjs Support

created 5 years ago

Hello Davide,
What version of SurveyJS do you use?
It works fine. If you need to show the property in the Question Editor then you need to add one extra step:
SurveyCreator.SurveyQuestionEditorDefinition.definition["question"].properties.push({name: "myPropertyName", index: 20});

Here is the example.

Thank you,
Andrew
SurveyJS Team

    Show previous comments (1)

      Hello Davide,
      Got it.
      Please call the code that add/remove properties before calling constructor of Survey Creator. Your code should started with this code, as in my example.

      Thank you,
      Andrew
      SurveyJS Team

        Hi Andrew,
        and thank you for your prompt answer. It's finally working out for me. The problem was in what order the javascript files were loading in my Ruby on Rails application. You example code was very helpful for the debugging. Thanks again!

          You are welcome, Davide!