easyui添加删除tooltip

/**
* 扩展两个方法
*/
$.extend($.fn.datagrid.methods, {
/**
* 开打提示功能
* @param {} jq
* @param {} params 提示消息框的样式
* @return {}
*/
doCellTip: function (jq, params) {
function showTip(data, td, e) {
if ($(td).text() == "")
return;
data.tooltip.text($(td).text()).css({
top: (e.pageY + 10) + ‘px‘,
left: (e.pageX + 20) + ‘px‘,
‘z-index‘: $.fn.window.defaults.zIndex,
display: ‘block‘
});
};
return jq.each(function () {
var grid = $(this);
var options = $(this).data(‘datagrid‘);
if (!options.tooltip) {
var panel = grid.datagrid(‘getPanel‘).panel(‘panel‘);
var defaultCls = {
‘border‘: ‘1px solid #333‘,
‘padding‘: ‘2px‘,
‘color‘: ‘#333‘,
‘background‘: ‘#f7f5d1‘,
‘position‘: ‘absolute‘,
‘max-width‘: ‘200px‘,
‘border-radius‘: ‘4px‘,
‘-moz-border-radius‘: ‘4px‘,
‘-webkit-border-radius‘: ‘4px‘,
‘display‘: ‘none‘
}
var tooltip = $("<div id=‘celltip‘></div>").appendTo(‘body‘);
tooltip.css($.extend({}, defaultCls, params.cls));
options.tooltip = tooltip;
panel.find(‘.datagrid-body‘).each(function () {
var delegateEle = $(this).find(‘> div.datagrid-body-inner‘).length ? $(this).find(‘> div.datagrid-body-inner‘)[0] : this;
$(delegateEle).undelegate(‘td‘, ‘mouseover‘).undelegate(‘td‘, ‘mouseout‘).undelegate(‘td‘, ‘mousemove‘).delegate(‘td‘, {
‘mouseover‘: function (e) {
if (params.delay) {
if (options.tipDelayTime)
clearTimeout(options.tipDelayTime);
var that = this;
options.tipDelayTime = setTimeout(function () {
showTip(options, that, e);
}, params.delay);
}
else {
showTip(options, this, e);
}

},
‘mouseout‘: function (e) {
if (options.tipDelayTime)
clearTimeout(options.tipDelayTime);
options.tooltip.css({
‘display‘: ‘none‘
});
},
‘mousemove‘: function (e) {
var that = this;
if (options.tipDelayTime)
clearTimeout(options.tipDelayTime);
//showTip(options, this, e);
options.tipDelayTime = setTimeout(function () {
showTip(options, that, e);
}, params.delay);
}
});
});

}

});
},
/**
* 关闭消息提示功能
*
* @param {}
* jq
* @return {}
*/
cancelCellTip: function (jq) {
return jq.each(function () {
var data = $(this).data(‘datagrid‘);
if (data.tooltip) {
data.tooltip.remove();
data.tooltip = null;
var panel = $(this).datagrid(‘getPanel‘).panel(‘panel‘);
panel.find(‘.datagrid-body‘).undelegate(‘td‘, ‘mouseover‘).undelegate(‘td‘, ‘mouseout‘).undelegate(‘td‘, ‘mousemove‘)
}
if (data.tipDelayTime) {
clearTimeout(data.tipDelayTime);
data.tipDelayTime = null;
}
});
}
});

时间: 2024-08-12 20:19:33

easyui添加删除tooltip的相关文章

双链集合添加删除算法

双链集合添加删除算法: package com.linkes; public class MyLinkeList { /** * 更多资料欢迎浏览凯哥学堂官网:http://kaige123.com * @author 小沫 */ /** * 链表集合他是于双链条式进行引用上下家,好处可以知道上家和下家是谁 * 利于修改,可以从首部开始删除数据也可以从尾部删除. * 即可从中间指定位置删除. */ private Object[] shou; private Object[] wei; // 默

如何恢复,迁移,添加, 删除 Voting Disks

如何恢复,迁移,添加, 删除 Voting Disks恢复流程 在11gR2 之前,我们可以直接直接使用dd命令对voting disk进行备份.DD示例 备份votedisk盘:[[email protected] bin]# dd if=/dev/raw/raw2 of=/home/oracle/voting_disk.bak 恢复votedisk盘:[[email protected] bin]# dd if=/home/oracle/voting_disk.bak of=/dev/raw

Linux/Ubuntu中添加删除新用户

操作环境:Ubuntu Server 14.04,系统上仅有一个用户root 1. adduser 命令添加新用户 #adduser username 注意adduser与useradd命令的区别,useradd是Linux系统中二进制可执行程序工具,adduser是封装了useradd之后的可执行脚本.因此adduser比useradd功能更加强大和智能,adduser在创建用户同时进行创建用户主目录等其他相关工作. 2.赋予新建用户管理员权限 只需要将用户加入sudo用户组中就可以赋予用户管

JTree 添加 , 删除, 修改

package com.swing.demo; import java.awt.BorderLayout; import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.CellEdi

class 样式的添加,删除,切换

<1> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="script/jquery-1.11.0.min.js" type="text/javascript"></script> <style type="text/css"&g

为虚拟磁盘 添加/删除物理磁盘

为虚拟磁盘 添加/删除物理磁盘 Add-Physicaldisk     此命令用于将指定的物理磁盘添加到虚拟磁盘    在存储池一节已经介绍过将物理磁盘加入存储池的用法,    在这里将介绍在虚拟磁盘上的用法    在正式介绍命令用法之前先回答 在Get-StoragePool,Get-VirtualDisk,New-VirtualDisk    三节中的提问    要获取未被虚拟磁盘使用的物理磁盘,你必须学会灵活的使用管道命令    $pool_pd = @(Get-StoragePool 

&lt;linux小脚本&gt;批量添加/删除用户

批量添加/删除用户,当输入add时,判断用户是否存在,存在则显示存在,不存在则添加:当输入del时,判断用户是否存在,存在则删除用户,不存在则显示不存在. #!/bin/bash if [ $1 == "add" ];then for i in {1..10}; do if id user$i &> /dev/null;then echo "the user$i exists!" else useradd user$i &> /dev/n

SQL Server 如何添加删除外键、主键,以及更新自增属性

1.添加删除主键和外键 例如: -----删除主键约束DECLARE @NAME SYSNAMEDECLARE @TB_NAME SYSNAMESET @TB_NAME = 'Date'SELECT TOP 1  @NAME=NAME FROM SYS.OBJECTS WITH(NOLOCK)WHERE TYPE_DESC ='PRIMARY_KEY_CONSTRAINT' AND PARENT_OBJECT_ID = (    SELECT OBJECT_ID    FROM SYS.OBJE

002-UIImageView和UIButton对比 UIImageView的帧动画 格式符补充 加载图片两种方式 添加删除SUBVIEW

一>.UIImageView和UIButton对比 显示图片 1> UIImageView只是一种图片(图片默认会填充整个UIImageView)  image\setImage: 2> UIButton能显示2种图片 * 背景 (背景会填充整个UIButton)  setBackgroundImage:forState: * 前置(覆盖在背景上面的图片,按照之前的尺寸显示)  setImage:forState: * 还能显示文字 点击事件 1> UIImageView默认是不能