I try to modify some data inside a custom field. The simplified structure is:
- data structure:
(string) "1|2|5|8"
- field options:
{"separator": "|"}
this.$updateValue = function(value, field) {
// value = (string) "1|2|5|8"
// field = (string) "entry.my_field_name"
if (typeof value == 'string') { // opts.separator is undefined
value = value.split(opts.separator ? opts.separator : ',');
}
// some more checks...
if (JSON.stringify(this.selected) != JSON.stringify(value)) {
this.selected = value;
this.update();
}
}.bind(this);
How can I access the field options inside this function? It’s somehow defined in riot.bind.js, but I don’t understand it. I tried to assign variables in this.on('mount', ...)
, in this.on('update', ...)
, at the top of the script, with all variations of this.opts
and $this.opts
… nothing worked.
@artur Can you give me a hint, please?