Skip to content

JSON object into enum - different keys and values #2442

@mbadal

Description

@mbadal

Hello,

I was just curious, whether is it possible to use JSON object (with values assigned to keys) as the base data for the ENUM rendering. I mean, I am sure it is possible, but currently only the values are being rendered in the template:

Enum definitions:

var enum = [
     "a",
     "b",
     "c"
];

var enum2 = {
     0: "a",
     1: "b",
     2: "c"
}

will both produce something like this:

<select>
        <option value="a">a</option>
        <option value="b">b</option>
        <option value="c">c</option>
</select>

I am just curious, is it possible to generate select with values, those are different from displayed text??

var enum = {
     1: "a",
     3: "b",
     5: "c"
};

This enum should produce something like this:

<select>
        <option value="1">a</option>
        <option value="3">b</option>
        <option value="5">c</option>
</select>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions