kendogrid过滤器菜单在鼠标离开时关闭 [英] kendogrid filter menu closing on mouseleave

查看:17
本文介绍了kendogrid过滤器菜单在鼠标离开时关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在带有 kendogrid.columnMenu: true 的 kendogrid 中,像这样 http://jsbin.com/AsEtoDik/2

in a kendogrid with kendogrid.columnMenu: true like this http://jsbin.com/AsEtoDik/2

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

there's a very annoying behavior: when you try to set a filter and the mouse goes out of the filter panel, it closes. It happens a lot especially filtering on a date column.

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

I guess this is intended but it's not very user friendly. I thought about setting a timer after the mouseleave event, delaying the closure of the menu, in jQuery but it looks rather difficult and I'd appreciate some help or suggestion

推荐答案

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

You can disable this behavior by replacing the Kendo Menu _mouseleave method (before you create the first instance):

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

然后您必须在菜单外部单击才能关闭它(演示).您可以使用超时来尝试您的想法,尽管可能会出现并发症;像这样的事情可能会奏效 - 虽然没有太多测试(demo):

Then you'll have to click outside of the menu to close it (demo). You can try your idea with the timeout, although there might be complications; something like this might work - haven't tested much though (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 配置选项,因此您可以为此设置默认选项.

Note: there's also the hoverDelay configuration option, so you may be able to set the default option for that.

这篇关于kendogrid过滤器菜单在鼠标离开时关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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