Problem with Source Binding to Arrays of Primitive Objects

3 posts, 0 answers
  1. Oleksa
    Oleksa avatar
    13 posts
    Member since:
    Apr 2019

    Posted 12 Nov 2019 Link to this post

    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. Martin
    Admin
    Martin avatar
    309 posts

    Posted 14 Nov 2019 Link to this post

    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.
  3. Oleksa
    Oleksa avatar
    13 posts
    Member since:
    Apr 2019

    Posted 14 Nov 2019 in reply to Martin Link to this post

    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!

Back to Top