Closed SamMousa closed 2 years ago
@SamMousa Here is the working example.
onCreated(question) {
// This is sample code, I know I could put this static array in the config above, but my goal is to load it dynamically.
//
const items = [
{
name: 'en-US',
title: 'English',
},
{
name: 'fr-FR',
title: 'French',
},
{
name: 'ar-AR',
title: 'Arabic',
},
];
const multipleQuestion = question.contentQuestion;
items.forEach(item => {
multipleQuestion.addItem(item.name, item.title);
});
}
Thank you, Andrew SurveyJS Team If you like our products, please take a moment to share your experience with our company by contributing a short review for SurveyJS page at g2.com or at Trustpilot.com. As we’re building our business, every review helps build credibility for future customers and your feedback would be greatly appreciated.
Does that mean docs are wrong?
@SamMousa The documentation is correct. You can store items in JSON. However, you have to assign the list of MultipleTextItemModel
instances.
It is similar to survey pages. It can be store in JSON and you can assign the list if pages but you can't assign a list of any object into survey.pages property.
Thank you, Andrew
Are you requesting a feature, reporting a bug or asking a question?
Bug or question
What is the current behavior?
I'm getting an error when trying to set multiple text item in a custom question's
onLoaded
event.What is the expected behavior?
I think it should work, but am not sure.
How would you reproduce the current behavior (if this is a bug)?
See test code or plunkr below, if you open developer tools you'll see this stack trace:
Provide the test code and the tested page URL (if applicable)
Tested page URL: https://plnkr.co/edit/Q9MlWJtnrwcWeAJj
Test code
Specify your