surveyjs / survey-creator

Scalable open-source survey software to generate dynamic JSON-driven forms within your JavaScript application. The form builder features a drag-and-drop UI, CSS Theme Editor, and GUI for conditional logic and form branching.
https://surveyjs.io/open-source
Other
910 stars 372 forks source link

Custom Element AddItem Not add Parameter in database #612

Open bhp2810 opened 5 years ago

bhp2810 commented 5 years ago

Are you requesting a feature, reporting a bug or ask a question?

What is the current behavior?

I used custom element dropdown and show data dynamically come from API. Below code used.

    .toolbox
    .addItem({
        name: "employee",
        isCopied: true,
        iconName: "icon-dropdown",
        title: "Employees",
        "renderAs": "select2",
        json: {
            "type": "dropdown",
            "renderAs": "select2",
            optionsCaption: "Select a Employee",
            choicesByUrl: {
                url: API_URL,
                path: "data",
                valueName: "id",
                titleName: "name"
            }
        }
    });```

I want to use select2 dropdown. so when I save this data for element in database it automatically remove "renderAs": "select2" option and it not saved in databse.

### What is the expected behavior?

Keep same as passed in code.

### How would you reproduce the current behavior (if this is a bug)?

#### Provide the test code and the tested page URL (if applicable)

Tested page URL:

Test code


### Specify your

* browser:
* editor version:
tsv2013 commented 5 years ago

Your question is unclear to me. The "renderAs" is a custom property that is valid only if the corresponding custom widget (select2) is loaded.

If this property is lost during survey JSON serialization then it isn't known to SurveyJS since not defined

mark-ellul commented 4 years ago

@tsv2013 how do you make select2 known to the SurveyJS Creator?