Updated Kendo UI Web MVVM Example

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    21 posts
    Member since:
    Nov 2011

    Posted 12 Jul 2012 Link to this post

    In the Kendo Web UI MVVM example (index.html), if you would like to see the kendoComboBox object with value and description bindings instead of the browser's select element, just paste this over the existing script tag in the body of index.html.  Hope this helps someone.

    <script>
         $(document).ready(function () {
             var genderCollection = [{ description: "Guy", value: "Male" }, { description: "Girl", value: "Female"}];
             var genderElement = $("#gender");
     
             $(genderElement).width(($("#fname").width() + 2));
             $(genderElement).css("margin-left", "-2px");
             $("#gender").kendoComboBox({ dataValueField: "value", dataTextField: "description" });
     
             var viewModel = kendo.observable({
                 firstName: "John",
                 lastName: "Doe",
                 genders: genderCollection,
                 gender: "Male",
                 agreed: false,
                 confirmed: false,
                 register: function (e) {
                     e.preventDefault();
                     this.set("confirmed", true);
                 },
                 startOver: function () {
                     this.set("confirmed", false);
                     this.set("agreed", false);
                     this.set("gender", "Male");
                     this.set("firstName", "John");
                     this.set("lastName", "Doe");
                 }
             });
     
             kendo.bind($("#example"), viewModel);
     
         });
     </script>

    Dan
  2. Long
    Long avatar
    1 posts
    Member since:
    Feb 2012

    Posted 28 Jul 2012 Link to this post

    Easy sample to get the jist of Kendo's MVVM for Web http://blog.longle.net/2012/07/28/teleriks-kendo-ui-web-mvvm-framework-rocks/
Back to Top