gpt4 book ai didi

jquery - Kendogrid 过滤器菜单在 mouseleave 上关闭

转载 作者:行者123 更新时间:2023-12-03 23:03:33 26 4
gpt4 key购买 nike

在kendogrid中使用kendogrid.columnMenu: true像这样http://jsbin.com/AsEtoDik/2

有一个非常烦人的行为:当您尝试设置过滤器并且鼠标移出过滤器面板时,它会关闭。这种情况经常发生,尤其是在日期列上进行过滤。

我猜这是有意的,但它不太用户友好。我考虑过在 mouseleave 事件之后设置一个计时器,延迟菜单的关闭,在 jQuery 中,但这看起来相当困难,我希望得到一些帮助或建议

最佳答案

您可以通过替换 Kendo Menu _mouseleave 方法来禁用此行为(在创建第一个实例之前):

kendo.ui.Menu.fn._mouseleave = function() {};

然后您必须单击菜单外部才能将其关闭 ( demo )。你可以用超时来尝试你的想法,尽管可能会出现一些复杂的情况;像这样的东西可能会起作用 - 但还没有进行太多测试( demo ):

var originalMouseLeave = kendo.ui.Menu.fn._mouseleave;
var mouseLeave = function (e) {
var that = this;
clearTimeout(this._timeoutHandle);
this._timeoutHandle = setTimeout(function () {
originalMouseLeave.call(that, e);
}, 1000);
}

kendo.ui.Menu.fn._mouseleave = mouseLeave;

var originalMouseEnter = kendo.ui.Menu.fn._mouseenter;
var mouseEnter = function (e) {
clearTimeout(this._timeoutHandle);
originalMouseEnter.call(this, e);
}

kendo.ui.Menu.fn._mouseenter = mouseEnter;

注意:还有 hoverDelay配置选项,因此您可以为其设置默认选项。

关于jquery - Kendogrid 过滤器菜单在 mouseleave 上关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20736235/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com