1:这个东西是我抄的(抄的哪儿的我就想不起来了- -)弹出的窗没有样式  不是很好看

//扩展
$.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' : '1px',
'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);
options.tipDelayTime = setTimeout(
function() {
showTip(options, that, e);
}, params.delay);
} else {
showTip(options, that, e);
}
}
});
}); } });
},
/**
* 关闭消息提示功能
* @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;
}
});
}
});
调用方法1:
function doCellTip(){  

$('#dg').datagrid('doCellTip',{'max-width':'100px'});

}

function cancelCellTip(){

$('#dg').datagrid('cancelCellTip');

}

调用方法2:

onLoadSuccess:function(data){

$('#dg').datagrid('doCellTip',{cls:{'background-color':'red'},delay:1000});

}


就这么着吧!!!

easyUI的doCellTip 就是鼠标放到单元格上有个提示的功能的更多相关文章

  1. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 表格:将悬停的颜色应用在行或者单元格上

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  2. Easyui之datagrid实现点击单元格修改单元格背景颜色

    前段时间有个需求中有点击datagrid的单元格实现某种事件,调用datagrid的onclickCell这个方法很容易实现,但是体验不好啊,完全不知道自己刚才点击的是哪个单元格,然后就尝试单击单元格 ...

  3. EXTJS 4.2 实现 gridpanel 鼠标悬停单元格以提示信息的方式显示单元格内容。

    由于gridpanel的单元格里的文字太多时候,都由省略号代替,就想实现如题的功能,经过反复实验,终于搞定了!直接上代码: me.on('itemmouseenter', function (view ...

  4. easyui datagrid合并相同数据的单元格。

    /** * 根据作用域填充单元格 */ function mergeCellsByField(tableID, colList) { var ColArray = colList.split(&quo ...

  5. 在JTable单元格上 加入组件,并赋予可编辑能力 [转]

    表格(单元格放置组件) 对于JTable单元格的渲染主要是通过两个接口来实现的,一个是TableCellRenderer另一个是TableCellEditor,JTable默认是用的是DefaultC ...

  6. [办公应用]如何将excel合并单元格分拆后每个单元格上仍保留数据?

    合并单元格虽然美观,但是无法进行排序.筛选等操作. 只有合并单元格拆分后才可以按常规进行统计.但是普通拆分后,excel仅保留合并单元格数据到区域左上角的单元格. 解决方案:选定多个合并单元格,应用本 ...

  7. 002-poi-excel-导出设置单元格数据校验规则、筛选功能

    一.数据验证概述 推荐以下操作在2007之后操作 1.1.查看excel的数据验证 1.进入 2.设置规则 通过验证条件允许,可以看到是每个单元格默认只成立一种条件 1.2.POI代码开发-数据验证 ...

  8. layui 鼠标悬停单元格显示全部

    {field : 'subjectId',title : '主题id',align: 'center',edit : 'text',templet:'<div><span title ...

  9. [原]界面上有几个球队名字的列表,将鼠标放到球队名字上就变为红色背景,其他球队背景颜色为白色,点击一个球队的时候就将点击的球队变为fontSize=30字体(fontSize=‘’回到默认)。

    window.onload = function () {             var uls = document.getElementById('ui').getElementsByTagNa ...

随机推荐

  1. Objective-C Delegate

    ios设计模式中的委托 Delegate 官方文档解释如下: Delegation is a simple and powerful pattern in which one object in a ...

  2. java下文件遍历,与删除

    package cn.stat.p1.file; import java.io.File; public class newfilelist { /** * @param args */ public ...

  3. log4j.property配置

    # 1. 日志等级 FATAL=0; ERROR=3; WARN=4; INFO=6; DEBUG=7; # 2. Appender 为日志输出目的地,Log4j提供的appender有以下几种# o ...

  4. C++中多重继承构造函数执行顺序

    代码1: #include <cstdio> #include <iostream> using namespace std; class A{ public: A(){ co ...

  5. 解读CSS文本(text)样式

    通过文本属性,您可以改变文本的颜色.字符间距.对齐文本.装饰文本.文本缩进,等等. color: 该属性用于改变文本的颜色,注意区分background-color. Line-height: 该属性 ...

  6. java三层模型与三层架构

    http://zhidao.baidu.com/question/316273675.html?qbl=relate_question_4 持久层用来固化数据,如常说的DAO层,操作数据库将数据入库业 ...

  7. input 不支持HTML5的placeholder属性

    解决方法如下: <input type="text" value="搜索乐高资讯" onfocus="if(this.value=='搜索乐高资 ...

  8. Linux编程遇到的问题汇集(持续更新中)

    1.源代码编译redis报告错误: undefined reference to `__sync_add_and_fetch_4' 最近项目组在实验Redis,源代码编译的时候,遇到了错误:undef ...

  9. A Simple Math Problem(HDU 1757 构造矩阵)

    If x < 10 f(x) = x.If x >= 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + …… + a9 * f(x-1 ...

  10. Hadoop-2.7.1集群环境搭建

    摘自:http://blog.csdn.net/u014039577/article/details/49813531 由于日志数据量越来越大,数据处理的逻辑越来越复杂,同时还涉及到大量日志需要批处理 ...