Sg2.9
dynamic lists for palette?
Recent RSS
dynamic lists for palette?
From:  jw kim
Date:  5. January 2012, 19:37

Is it possible to have 1 list in a palette change based on the selection made from another list?

i.e. List 1 choices - [1, 2, 3]

if List 1 is 1 - List 2 choices are then[4, 5]
if List 1 is 2 - List 2 choices are then [6, 7]
if List 1 is 3 - List 2 choices are then [8, 9]

Re: dynamic lists for palette?
From:  Marat Shagiev
Date:  5. January 2012, 22:23

Hi, jw kim!
If I understand you correctly, you can do so here:

var values = {
    list1: 1,
    list2: 4,
}

var components = {
    list1: {
        type: 'list',
        options: [1,2,3],
        onChange: function (value) {
            if (value == 1) {
                components.list2.options = [4,5]
            }
            else if (value == 2) {
                components.list2.options = [6,7]
            }
            else if (value == 3) {
                components.list2.options = [8,9]
            }
        }
    },
    list2: {
        type: 'list',
        options: [4,5],
    },
}

var palete = new Palette('dinamic list', components, values)
Re: dynamic lists for palette?
From:  jw kim
Date:  5. January 2012, 23:47

Wonderful. Thank you very much!

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Boxes Flow 19.04.12