Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 带外部搜索框和按键的剑道MVVM_Javascript_Kendo Ui_Binding_Kendo Mvvm - Fatal编程技术网

Javascript 带外部搜索框和按键的剑道MVVM

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

我有一些代码,有一个剑道UI网格的外部搜索框。这与这里的示例类似 但是,它使用Kendo MVVM使用typescript

HTML代码有一个输入搜索框和按钮类,如下所示

    <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);
    }
});