丢失过滤器菜单内的文本框值 [英] Lost the text boxes values inside the filter menu
问题描述
我写了一个带有kendo网格和过滤器菜单的html/javascript页面.我遇到了以下问题:当我向数据源(新行)添加一个新对象并且其kendogrid被重新加载(datasource.read)时,我丢失了正在输入值的过滤器菜单内的文本框值.
I writting a html/javascript page with a kendo grid with filter menu. I have faced the following problem: when I add a new object to the data source (new row) and its kendogrid is reloaded (datasource.read) I lose the textboxes values inside the filter menu that I was inputting the values.
这里是演示: http://jsfiddle.net/3qT3J/2/ >
Here is the demo: http://jsfiddle.net/3qT3J/2/
$("#grid").kendoGrid({
dataSource: datasource1,
height: 300,
filterable: true // <== shows a button on each column that display a filter menu
});
// reload the grid every 2 seconds:
setInterval(function() {
datasource1.read();
}, 2000);
重新加载网格时,是否有任何方法可以再次填充文本框?如何获得用户输入的值?是否有一些kendogrid属性可以避免在重新加载网格时丢失值?
Is there any way to fill the textboxes again when the grid is reloaded? how can I get the values entered by the user? Is there some kendogrid property that avoid to lose the values when the grid is reloaded?
我曾想在文本框中使用事件监听器获取值,但是我不知道文本框属于哪一列...我使用以下代码添加了事件监听器: $(.k-textbox").on("click change",function1);
I thought to get the values with an event listener in the textboxes, but I don't know which column the text box belongs... I added the event listener with the following code: $(".k-textbox").on("click change", function1);
有什么主意吗? 谢谢
推荐答案
您可以在打开过滤器菜单时暂停重新加载,以便用户可以完成输入:
You could pause reloading while the filter menu is open so the user can finish typing:
setInterval(function () {
var pauseRefresh = $(".k-filter-menu:visible").length;
if (!pauseRefresh) {
datasource1.read();
}
}, 2000);
(演示)
这篇关于丢失过滤器菜单内的文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!