How do I set value of a Select2 field?
How do I set value of a Select2 field?
Hello -
LONG time user of DataTables, still learning about Editor.
I am attempting to set the value of a field in Editor which is marked as a "Select2" field type which uses as set of objects in the format {label: "xxxxxx", value: "xxxxx"}
I am able to set other Select2 fields if using an array of values (of which each index is used as both label and value), but not a field which is using a set of Objects.
I am cycling through the array of Options directly from the Editor's field instance, and setting the value if there is a match to another value.
I have tried setting the value to a matching object of the exact same structure, setting it to the value: of the object, setting it to the label: of the object. nothing is working.
Thanks very much.
Answers
Hi @dcdc ,
You should just be able to say:
When you say nothing is working, are you seeing console errors? Is the field appearing empty? If you could link to the page, that would be helpful.
Cheers,
Colin