I need create keyPress (enter) binding for input.
<div id="body">
<input type="text" data-value-update="keyup" data-bind="value: text, keyPress: onKeyPress"/>
<div id="output"></div>
</div>
js:
kendo.data.binders.widget.keyPress = kendo.data.Binder.extend({
init: function (element, bindings, options) {
kendo.data.Binder.fn.init.call(this, element, bindings, options);
var binding = this.bindings.keyPress;
$(element.input).bind("keypress", function (e) {
if (e.which == 13) {
binding.get();
}
});
},
refresh: function () { }
});
var viewModel = kendo.observable({
text: '',
onKeyPress: function () {
$("#output").append("<div>keyPress</div>");
}
});
kendo.bind("#body", viewModel);
I had have error:
Error: The keyPress binding is not supported by the input element
Example in jsfiddle http://jsfiddle.net/dude_jsfiddle/byA75/