Kendo UI: Source Binding to Arrays of Primitive Objects

398 Views Asked by At

Here is the original article from Kendo UI about binding to arrays of primitive objects: https://docs.telerik.com/kendo-ui/framework/mvvm/bindings/source#source-binding-to-arrays-of-primitive-objects

In my project I need to work with an array of strings as the values of input elements. And I was wondering if anyone knows why it's not possible to use the following template:

<script id="ul-template" type="text/x-kendo-template">
    <li>
        <input type="text" data-bind="value: this" />
        <a class="k-button textButton" title="Remove" data-bind="events: { click: removeValue }" href="\\#"><span class="k-icon k-i-close"></span></a>
    </li>
</script>

Instead of the one, provided in their docs:

<script id="ul-template" type="text/x-kendo-template">
    <li data-bind="text: this"></li>
</script>

Whatever I tried it simply doesn't list the elements above with the primitive data like [ "Coffee", "Tea", "Juice" ], but it works if there are objects instead of simple strings like [ {product: "Coffee"}, {product: "Tea"}, {product: "Juice"} ], which is not preferable solution in my case.

What am I doing wrong? Thanks in advance.

0

There are 0 best solutions below