"Flow Control" bindings in MVVM binding

4 posts, 0 answers
  1. Stacey
    Stacey avatar
    5 posts
    Member since:
    Jul 2013

    Posted 02 Jul 2013 Link to this post


    In knockoutJS, I have become accustomed to "Flow Control" bindings for the HTML binding. Such as ...

    foreach : http://knockoutjs.com/documentation/foreach-binding.html

            <tr><th>First name</th><th>Last name</th></tr>
        <tbody data-bind="foreach: people">
                <td data-bind="text: firstName"></td>
                <td data-bind="text: lastName"></td>
    <script type="text/javascript">
            people: [
                { firstName: 'Bert', lastName: 'Bertington' },
                { firstName: 'Charles', lastName: 'Charlesforth' },
                { firstName: 'Denise', lastName: 'Dentiste' }

    and "with" : http://knockoutjs.com/documentation/with-binding.html

    <h1 data-bind="text: city"> </h1>
    <p data-bind="with: coords">
        Latitude: <span data-bind="text: latitude"> </span>,
        Longitude: <span data-bind="text: longitude"> </span>
    <script type="text/javascript">
            city: "London",
            coords: {
                latitude:  51.5001524,
                longitude: -0.1262362

    and if : http://knockoutjs.com/documentation/if-binding.html

    <label><input type="checkbox" data-bind="checked: displayMessage" /> Display message</label>
    <div data-bind="if: displayMessage">Here is a message. Astonishing.</div>

    and ifnot : http://knockoutjs.com/documentation/if-binding.html

    <div data-bind="ifnot: someProperty">...</div>

    These have become a vital part of the way I structure views and such, and I would be very upset to lose them. I notice that no such alternatives seem to exist in Kendo UI MVVM? Is this true? Are there any plans for such in the future? This is a very big deal breaker for me.

  2. Alexander Valchev
    Alexander Valchev avatar
    2895 posts

    Posted 04 Jul 2013 Link to this post

    Hello Stacey,

    Thank you for getting in touch with us. Regarding your questions:
    1. The equivalent of foreach binding in Kendo MVVM is source and template binding. For more information please check the corresponding help article.

    2. It is true that Kendo MVVM does not have a with binding, but you can achieve a similar result by specifying the field path with dot notation syntax.

          Latitude: <span data-bind="text: coords.latitude"> </span>,
          Longitude: <span data-bind="text: coords.longitude"> </span>
    3. I am afraid that there is no equivalent for if/ifnot bindings. If you would like to see them implemented in the future I suggest you to open a feature request on Kendo UI Feedback portal. In this way the other users would be able to vote for this idea. If it turns out to be popular we will consider it for one of our future releases.

    Alexander Valchev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. ace
    ace avatar
    1 posts
    Member since:
    Oct 2006

    Posted 10 Apr 2015 in reply to Alexander Valchev Link to this post

    This example does not show how to access a child record. Can you provide an example?

     I need to access Person. Children for a from the Person object.


    foreach  (child in  Person.Children)





  4. Petyo
    Petyo avatar
    2444 posts

    Posted 14 Apr 2015 Link to this post

    Hello Keith,

    If I understand you correctly, you may nest the source/template bindings in case you want to display the child records. If this is not the case, can you please elaborate further? Thank you in advance. 

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top