I am using toKeyedObject formatter and works great.
Fist I have this:
<dmx-value id="printContent" dmx-bind:value="pageContent.data.siteContent.toKeyedObject(`keySearch`, `content`)"></dmx-value>
To retrieve the necessary content information, I use the following method:
<div bycom="true">{{printContent.value.test}}</div>
Which 'test' is the key that look for in the array. Here all works fine.
Now the question is that this 'test' value can be Dynamic ?? I have tried this whitout success.
<div bycom="true">{{printContent.value.(var1.value)}}</div>
Is this possible?? What is the sintaxis I need to use??
The original formatter function is this only as reference:
<script>
dmx.Formatters('array', {
toKeyedObject: function(array, key, value) {
var newObj = {};
for (var ai=0; ai < array.length; ai++) {
newObj[array[ai][key]] = array[ai][value];
}
return newObj;
}
});
</script>