• About Morris Development
  • A Focus for Cloud Efficiency
    • Microsoft Azure
    • Amazon Web Services
  • What our Clients Say
  • Our Products
    • PreschoolDB
    • WebinarDB
  • Contact Us

Morris Development

Custom System Development and Integration

March 24, 2015

Databound Kendo Forms (MVVM) using jQuery ajax

Telerik offers several great modules in their Kendo UI package.  Unfortunately, I’ve found that the kendo datasource object is simply not well suited for binding forms.  However, the kendo view model is extendable and can easily accept data from a $.ajax call.

In the sample below, we’re pulling data from a simple webapi that returns a single json record.

The ajax is simple. First, we get the data from our endpoint.

 
//Retrieve the model data from the remote endpoint
         $.ajax({
             url: myEndpointURL,
             type: "GET",
             dataType: "json"
         });

 
That’s easy enough. Just having that in code will put the information for you. Now, we need Kendo to get it. That’s also easy. We just extend the viewmodel to include the returned data and then bind it, directly within the on-success of the ajax call:

 
//Retrieve the model data from the remote endpoint
         $.ajax({
             url: myEndpointURL,
             type: "GET",
             dataType: "json",
             success: function (model) {
                 // extend the viewModel with the response from the server
                 $.extend(viewModel, model);
                 // bind to the viewModel
                 kendo.bind(document.body, viewModel);
             }
         });

 

Once we have that data, we need to link it to the form using data-binds, like below:

    


So, what that’s going to do is pull in your data from any WebApi, drop it into an local object and populate your form. It’s very fast and slick, but there are limited tools for debugging. To save time, it is best to start with some pre-made scripts that function pefectly well, using mockjax. This way you can build a functioning form right off the bat without even having your service complete.

Here is a working sample: (click to open in new window)

Article by MacGyver / Kendo, Web Developer, WebApi

About MacGyver

I've worked with database systems for over 20 years, and started my own company in 2000. Almost all my business consists of internal database systems, either ERP or CRM. My programming is primarily in Angular / Microsoft C# and MS SQL.

About This Site

Morris Development has been specializing in internal database system design and integration since 1999. We provide long-term management and support of secure data systems for many businesses as well as developing the more complex code structures for ERP systems like Intellievent, Apidas, and AVMS.

This site is primarily for our developers to keep track up various technologies and updates that are used by Morris Development.

Training

Integrating Angular Microsite with .Net

Private Data Caching with Google Storage

Continuous Deployment for Production Releases?

Azure Websites – the perfect Angular host

Angular 2

  • Angular 2 Authentication
  • Angular Command Line Interface
  • Material Design for Angular
  • Using Observables in Angular 2

Mentors

  • Ben Nadel
  • Dan Wahlin
  • Deborah Kurata
  • John Papa

Staff

  • Dan Morris

Training

  • Google Development Courses
  • Microsoft Virtual Academy
  • PluralSight
  • Test Deep Links

© 2025 · Morris Development