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

Updated Kendo UI Web MVVM Example

1 Answer 122 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 12 Jul 2012, 09:15 PM
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

1 Answer, 1 is accepted

Sort by
0
Long
Top achievements
Rank 1
answered on 28 Jul 2012, 07:12 AM
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/
Tags
MVVM
Asked by
Daniel
Top achievements
Rank 1
Answers by
Long
Top achievements
Rank 1
Share this question
or