Javascript 带外部搜索框和按键的剑道MVVM
我有一些代码,有一个剑道UI网格的外部搜索框。这与这里的示例类似 但是,它使用Kendo MVVM使用typescript HTML代码有一个输入搜索框和按钮类,如下所示Javascript 带外部搜索框和按键的剑道MVVM,javascript,kendo-ui,binding,kendo-mvvm,Javascript,Kendo Ui,Binding,Kendo Mvvm,我有一些代码,有一个剑道UI网格的外部搜索框。这与这里的示例类似 但是,它使用Kendo MVVM使用typescript HTML代码有一个输入搜索框和按钮类,如下所示 <div style="display:block;width:100%;padding:5px;"> <input style="width:70%;height:30px;" id="searchvalue" /> <button class="km-s
<div style="display:block;width:100%;padding:5px;">
<input style="width:70%;height:30px;" id="searchvalue" />
<button class="km-small" data-icon="search" belongsto="searchvalue" data-role="button" data-bind="events : {click: filterLocations }"></button>
</div>
但是,我希望使用在搜索框中键入的文本调用相同的filterLocations() 您可以用绑定
单击事件的相同方式绑定按键事件:
<input type="text" class="k-textbox" data-bind="events: { keypress: onKeyPress }"></input>
var viewModel = kendo.observable({
onKeyPress: function(e){
console.log(e)
},
onClick: function(e) {
console.log(e);
}
});
var viewModel=kendo.observable({
ON按键:功能(e){
控制台日志(e)
},
onClick:函数(e){
控制台日志(e);
}
});
例如:
<input type="text" class="k-textbox" data-bind="events: { keypress: onKeyPress }"></input>
var viewModel = kendo.observable({
onKeyPress: function(e){
console.log(e)
},
onClick: function(e) {
console.log(e);
}
});