Skip to content

DEVELOPMENT - this is not production ready

Custom Dropdown Fields

TODO: implement and document

Converts "normal" <input/> fields into dropdown fields ( <select/> ) with custom options.

Single Select

1
2
var dv = AppGiniHelper.dv;
dv.getField("input_fieldname").toDropdownSimple(['a', 'b', 'c']);

Multiselect

1
2
var dv = AppGiniHelper.dv;
dv.getField("input_fieldname").toDropdownSimple(['a', 'b', 'c'], true);

Note the 2nd parameter true which makes it multi-select


Options with ID and Text

1
2
3
4
5
6
7
8
var options = [
    new AppGiniDropdownOption(1, "A"),
    new AppGiniDropdownOption(2, "D"),
    new AppGiniDropdownOption(3, "C"),
    new AppGiniDropdownOption(26, "Z"),
];
var dv = AppGiniHelper.dv;
dv.getField("input_fieldname").toDropdown(options);

Attention

When, later on, using .getValue()-function on such fields, the value will be an object, having id and text.


Mix of both, string and [id, text] entries

You can even mix options like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
var options = [

    "a",
    "b",
    "c",
    new AppGiniDropdownOption(1, "A"),
    new AppGiniDropdownOption(2, "D"),
    new AppGiniDropdownOption(3, "C"),
    new AppGiniDropdownOption(26, "Z"),
];
dv.getField("sent_by").toDropdown(dropdown_options, true);

Attention

When, later on, using .getValue()-function on such fields, the value might be a simple string or an object, having id and text. You should type-check before using.

Recommendation

Allthough possible, to avoide unexpected results I recommend not to mix up both.


See also