Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom specialized question types do not inherit properties from the base question type #7661

Closed
RomanTsukanov opened this issue Jan 12, 2024 · 0 comments · Fixed by #7690
Closed
Assignees
Milestone

Comments

@RomanTsukanov
Copy link
Contributor

When it comes to custom question types, we provide two options:

  1. Create a specialized question type.
  • Properties listed in questionJSON are hardcoded and cannot be edited.
  • The custom question type is respresented in the UI (type selector, etc.) as a genuine question type.
  • Properties of the base class are not inherited.
  1. Add a custom toolbox item.
  • Properties listed in questionJSON can be edited in Survey Creator.
  • The custom question type looks like the question type it's based upon.
  • Possesses all the properties of the base class.

However, there's middle-ground option, where questionJSON properties are hardcoded but properties of the base class are inherited. I think we should extend option 1 and let the user decide whether to inherit base class properties.

Survey.ComponentCollection.Instance.add({
  name: "country", 
  title: "Country", 
  defaultQuestionTitle: "Country",
  questionJSON: {
    "type": "dropdown",
    "placeholder": "Select a country...",
    "choicesByUrl": {
      "url": "https://surveyjs.io/api/CountriesExample",
    }
  },
  inheritBaseProps: true // inherits properties of the Dropdown question
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants