Skip to content

tabarray first tab content not displayed until click away and back #950

Open
@skidvd

Description

@skidvd

I am using the 1.0.0-alpha.4 version.

???

As a user/developer, when I use tabarray for definition I should be able to have first tab displayed

Expected behaviour

I expected the first tab to be displayed by default

Actual behaviour

It actually displays the first tab selector as active/chosen, but with no actual tab contents vsible. Upon clicking on another tab (or adding another value to array), and then clicking back to the first tab, the contents are correctly displayed

When using the following template:

<form name="forms.schemaForm" sf-schema="schema" sf-form="form" sf-model="model"></form>

and scope definitions:

$scope.schema = {
    "id": "/static-assets/dist/schema/messages.json",
    "$schema": "http://json-schema.org/draft-04/schema#",
    type: "object",
    "definitions": {
        "address": {
            "type": "object",
            "properties": {
                "street_address": { "type": "string", title: "Street Address" },
                "city":           { "type": "string", title: "City" },
                "state":          { "type": "string" }
            },
            "required": ["street_address", "city", "state"]
        }
    },
    properties: {
        name: {type: "string", minLength: 2, title: "Name", description: "Name or alias"},
        title: {
            type: "string",
            enum: ['dr', 'jr', 'sir', 'mrs', 'mr', 'NaN', 'dj']
        },
        dob: {type: "number", title: "DOB", description: "Date of birth"},
        subforms: {
            type: "array",
            items: {
                type: "object",
                properties: {
                    name: {type: "string"},
                    address: {"$ref": "#/definitions/address"},
                    phone: {type: "string"}
                }
            },
        }
    }
};

$scope.form = [
    "name",
    "title",
    "dob",
    {
        type: "tabarray",
        title: "{{value.name || 'Person index ' + $index}}:",
        key: "subforms",
        add: "Add person",
        remove: "Remove person",
        style: {
            add: "btn-success",
            remove: "btn-danger"
        },
        items: [
            "subforms[].name",
            "subforms[].phone",
            "subforms[].address"
        ],
        //startEmpty: false
    },
    {
        type: "submit",
        title: "Save",
    }
];

$scope.model = {
    //subforms: [
    //    {
    //        phone: '123-456-7890',
    //        address: {
    //            street_address: '123 Main'
    //        }
    //    }
    //]
};

I have experimented with supplying non-emtpy initial values in the model as well as startEmpty: false, but nothing appears to positively affect the behavior described above (empty initial tab contents until click away and back).

@json-schema-form/angular-schema-form-lead

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions