Hi,
I receive some data in array format and need to initialize checkboxes with that data.
Something like this: http://webix.com/snippet/7d5b4a58
But I can’t guess how to do it
Can you please help?
Really I have a bit more heavy condition like this: http://webix.com/snippet/0adc9f29
The setValues
method needs the specified names of elements.
So there’s only way to do this:
http://webix.com/snippet/e227f668
In some cases, the concat
function can simplify the work with arrays.
Thanks, I created my own method for this:
setArrayValues: function (values) {
var newValues = {};
for (var key in values) {
var val = values[key];
if (val instanceof Array) {
for (var i in val) {
if (val[i] instanceof Array) {
for (var j in val) {
newValues[key + '[' + i + ']['+j+']'] = val[i][j];
}
} else
newValues[key + '[' + i + ']'] = val[i];
}
}
else {
newValues[key] = values[key];
}
}
this.setValues(newValues);
}