如何更改剑道绑定 html 输入的值 [英] How to change the value of a kendo bound html input

查看:19
本文介绍了如何更改剑道绑定 html 输入的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有用于编辑的自定义弹出窗口的 kendoui 网格.

I have a kendoui grid with a custom popup for editing.

在这个弹出窗口中,我有一个绑定到网格值的输入:

In this popup I have an input which is bound to a value of the grid:

<input type="text" class="k-input k-textbox" id="test" data-bind="value:SearchFilter">

这很好用.单击网格中的编辑,更改文本框中的值,该值将传播到网格.

This works fine. Click edit in the grid, change the value in the textbox and the value propagates to the grid.

但现在我想在 javascript 中更改文本框的值.. 所以我现在有了这个:

But now I want to change the value of the textbox in javascript.. So I now have this:

$('#test').val("testvalue");

这确实改变了文本框的值,但在保存时新值不会传播到网格.我猜是因为文本框上没有发生更改事件.

This indeed changes the value of the textbox, but upon save the new value isn't propagated to the grid. I guess because no change event occurs on the textbox.

我该如何进行这项工作?

How do I make this work?

推荐答案

您需要模拟更改事件.试试这个代码:

You need simulate change event. Try this code:

$('#test').val("testvalue").change();

这篇关于如何更改剑道绑定 html 输入的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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