处理IE 9&带有敲除绑定的10清除按钮 [英] Handle IE 9 & 10's clear button with Knockout binding

查看:57
本文介绍了处理IE 9&带有敲除绑定的10清除按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个输入文本框,它绑定到一个淘汰赛可观察到的地方.

I have an input text box bound to a knockout js observable.

<input id="searchTextBox" class="searchTextBox" type="text" maxlength="25"
       title="Search" placeholder="Search"
       data-bind="value: GridVm.FilterText,
       valueUpdate: 'afterkeydown',
       disable: GridVm.Data().length == 0" />

问题在于,当用户单击IE中的x时,可观察的FilterText不会更新.

The problem is that the FilterText observable doesn't update when the user clicks the x in IE.

我发现我可以这个论坛说点击x时不会触发任何事件.

I've found that I can remove the x (see the screen shot in the linked question), but that's a last resort (I like the feature). This forum says there is no event fired when the x is clicked.

是否存在可以用来强制执行Knockout可观察更新的事件,还是在Knockout中执行此更新的一种好方法?

Is there an event that I can use to force a Knockout observable update or a good way to do this in Knockout?

推荐答案

如果您只是更改

valueUpdate: 'afterkeydown'

valueUpdate: 'input'

它钩住该事件以触发值更新.总体上来说更好,因为它还可以处理基于剪贴板的动作和文本拖放动作.

it hooks that event to trigger the value update. It's better overall because it also handles clipboard-based actions and text drag-drop actions.

这篇关于处理IE 9&amp;带有敲除绑定的10清除按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆