Skip to content Skip to sidebar Skip to footer

Kendo Ui Javascript : Remote Bind Form

I'm having trouble getting started with binding a Form to a remote Datasource in Kendo UI for javascript I have verified that the ajax call returns the correct JSONP payload, e.g:

Solution 1:

Your textbox is bound to a username property but this doesn't exist on your view-model, nor is it being populated anywhere. Assuming your datasource correctly holds an employee after your call to read(), you will need to extract it and set it into your viewmodel using something like this:

change: function(e) {
    vardata = this.data();
    if (data.length && data.length === 1) {
        this.set("employee", data[0]);
        this.set("hasChanges", true);
    }
}

And modify the binding(s) like this:

<inputclass="form-control k-textbox"type="text"id="username"
  data-bind="value: employee.username, events: { change: change }" />

You should also be aware that the change event is raised in other situations, so if you start using the datasource to make updates for example, you'll need to adapt that code to take account of the type of request. See the event documentation for more info. Hope this helps.

Post a Comment for "Kendo Ui Javascript : Remote Bind Form"