This is a migrated thread and some comments may be shown as answers.

Problem with Source Binding to Arrays of Primitive Objects

2 Answers 28 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Oleksa
Top achievements
Rank 1
Oleksa asked on 12 Nov 2019, 09:37 AM

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.

For your convenience I created the sample of what I need in DOJO, here is the URL: https://dojo.telerik.com/uWEdIroR/3

What am I doing wrong? Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 14 Nov 2019, 12:54 PM

Hello Oleksiy,

Thank you for the provided example. You will find my reply in the support ticket you opened.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Oleksa
Top achievements
Rank 1
answered on 14 Nov 2019, 01:42 PM

Hi Martin,

I just replied to the ticket. Let's keep the conversation in there. I'll post here the solution once we find it.

Thank you!

Tags
MVVM
Asked by
Oleksa
Top achievements
Rank 1
Answers by
Martin
Telerik team
Oleksa
Top achievements
Rank 1
Share this question
or