Lost the text boxes values inside the filter menu

自闭症网瘾萝莉.ら 提交于 2019-12-24 03:45:22

问题


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.

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

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?

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

Any idea? Thanks


回答1:


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

(demo)



来源:https://stackoverflow.com/questions/21135777/lost-the-text-boxes-values-inside-the-filter-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!