ulion / jsonform

Build forms from JSON Schema. Easily template-able. Compatible with Twitter Bootstrap out of the box.
http://ulion.github.io/jsonform/playground/
MIT License
49 stars 27 forks source link

add missing property for clone node #13

Closed wuminorb closed 9 years ago

wuminorb commented 9 years ago

forgot clone ’childPos’ property during clone node

ulion commented 9 years ago

What problem this PR try to resolve? any test case?

wuminorb commented 9 years ago

If you try to use array of 'selectfieldset',missing 'childPos' will cause a bug that you can't select field set correctly. You can test this with JSON below.

{
    schema: {
        "source": {
            "type": "array",
            "items": {
                type: "object",
                "title": "data source",
                "properties": {
                    filename: {
                        type: 'string',
                        title: "filename",

                    },
                    dbaddr: {
                        type: 'string',
                        title: "address of database",

                    },
                    "kind": {
                        "type": "string",
                        "title": "type",
                        "enum": ["excel",
                        "db"]
                    }
                }
            }
        }
    },
    form: [{
        "type": "array",
        "items": {
            "type": "section",
            "items": [{
                "type": "selectfieldset",
                "key": "source[].kind",
                "title": "source",
                "titleMap": {
                    "excel": "Excel",
                    "db": "Database"
                },
                "items": ["source[].filename","source[].dbaddr"]
            },
            ]
        }
    }]
}