surveyjs adding properties to elements problem

1.1k Views Asked by At

So i've been trying to integrate SurveyJS into our survey app to see if it matches our needs, but i keep having a problem adding properties to the elements. I looked around here and on their forum, also their documentation and could find nothing that would fix this.

So what is working is this :

var survey = new Survey.Model(surveyJSON, "surveyContainer");
Survey.JsonObject.metaData.addProperty("question", {name: "id", category: "general"})

Now what is not working ... is putting different property names to questions OR choices (checkboxes for ex). So these 2 lines below, don't work :

Survey.JsonObject.metaData.addProperty("question", {name: "id", category: "general"})
Survey.JsonObject.metaData.addProperty("itemvalues", {name: "id", category: "general"})

Any clue what i might be doing wrong ?

1

There are 1 best solutions below

0
On BEST ANSWER

Here is the live plunker sample - https://plnkr.co/edit/CiTbfcucCopWBA8j

The code is:

Survey.Serializer.addProperty('itemvalue', {
    name: 'id',
    category: 'general',
});

SurveyCreator.SurveyQuestionEditorDefinition.definition[
    'itemvalue[]@choices'
].properties.push('id');