/**
* Created with JetBrains WebStorm.
* User: cao.guanghui
* Date: 13-6-26
* Time: 下午11:27
* To change this template use File | Settings | File Templates.
*/
$.extend($.fn.datagrid.methods, {
/**
* 开打提示功能(基于1.3.3+版本)
* @param {} jq
* @param {} params 提示消息框的样式
* @return {}
*/
doCellTip:function (jq, params) {
function showTip(showParams, td, e, dg) {
//无文本,不提示。
if ($(td).text() == "") return;
params = params || {};
var options = dg.data('datagrid');
var styler = 'style="';
if(showParams.width){
styler = styler + "width:" + showParams.width + ";";
}
if(showParams.maxWidth){
styler = styler + "max-width:" + showParams.maxWidth + ";";
}
if(showParams.minWidth){
styler = styler + "min-width:" + showParams.minWidth + ";";
}
styler = styler + '"';
showParams.content = '<div class="tipcontent" ' + styler + '>' + showParams.content + '</div>';
$(td).tooltip({
content:showParams.content,
trackMouse:true,
position:params.position,
onHide:function () {
$(this).tooltip('destroy');
},
onShow:function () {
var tip = $(this).tooltip('tip');
if(showParams.tipStyler){
tip.css(showParams.tipStyler);
}
if(showParams.contentStyler){
tip.find('div.tipcontent').css(showParams.contentStyler);
}
}
}).tooltip('show');
};
return jq.each(function () {
var grid = $(this);
var options = $(this).data('datagrid');
if (!options.tooltip) {
var panel = grid.datagrid('getPanel').panel('panel');
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[field]', {
'mouseover':function (e) {
//if($(this).attr('field')===undefined) return;
var that = this;
var setField = null;
if(params.specialShowFields && params.specialShowFields.sort){
for(var i=0; i<params.specialShowFields.length; i++){
if(params.specialShowFields[i].field == $(this).attr('field')){
setField = params.specialShowFields[i];
}
}
}
if(setField==null){
options.factContent = $(this).find('>div').clone().css({'margin-left':'-5000px', 'width':'auto', 'display':'inline', 'position':'absolute'}).appendTo('body');
var factContentWidth = options.factContent.width();
params.content = $(this).text();
if (params.onlyShowInterrupt) {
if (factContentWidth > $(this).width()) {
showTip(params, this, e, grid);
}
} else {
showTip(params, this, e, grid);
}
}else{
panel.find('.datagrid-body').each(function(){
var trs = $(this).find('tr[datagrid-row-index="' + $(that).parent().attr('datagrid-row-index') + '"]');
trs.each(function(){
var td = $(this).find('> td[field="' + setField.showField + '"]');
if(td.length){
params.content = td.text();
}
});
});
showTip(params, this, e, grid);
}
},
'mouseout':function (e) {
if (options.factContent) {
options.factContent.remove();
options.factContent = null;
}
}
});
});
}
});
},
/**
* 关闭消息提示功能(基于1.3.3版本)
* @param {} jq
* @return {}
*/
cancelCellTip:function (jq) {
return jq.each(function () {
var data = $(this).data('datagrid');
if (data.factContent) {
data.factContent.remove();
data.factContent = null;
}
var panel = $(this).datagrid('getPanel').panel('panel');
panel.find('.datagrid-body').undelegate('td', 'mouseover').undelegate('td', 'mouseout').undelegate('td', 'mousemove')
});
}
});

datagrid.celltips.js的更多相关文章

  1. easyui的datagrid用js插入数据等编辑功能的实现

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

  2. datagrid后台分页js.js

    $(function () { gridbind(); bindData(); }); //表格绑定function gridbind() { $('#dg').datagrid({ title: ' ...

  3. datagrid后台分页js

    $(function () { gridbind(); bindData(); }); //表格绑定function gridbind() { $('#dg').datagrid({ title: ' ...

  4. DevExtreme学习笔记(一) DataGrid中js分析

    1.overviewjs采用 $(function() { $("#gridContainer").dxDataGrid({ dataSource: { store: { type ...

  5. 基于1.3.3版本tooltip的datagrid单元格tip实现

    基于1.3.3版本tooltip的datagrid单元格tip实现 2013年05月25日 ⁄ datagrid ⁄ 共 6122字 ⁄ 评论数 26 ⁄ 被围观 7,033 views+ 文章目录 ...

  6. RDIFramework.NET框架Web中datagrid与treegrid控件自动生成右键菜单与列标题右键菜单

    在实际应用中常可以看到数据展示控件有右键菜单的功能,对应的列标题也可以右键弹出快捷菜单设置指定列的显示与隐藏等功能.在我们的RDIFramework.NET Web框架中,只要是使用了EasyUI的D ...

  7. easyloader.js源代码分析

    http://www.cnblogs.com/jasonoiu/p/easyloader_source_code_analysis.html Jquery easyui是一个javascript UI ...

  8. easyui datagrid使用

    http://www.cnblogs.com/zgqys1980/archive/2011/01/04/1925775.html 加载相关js和css,因为easyui依赖jquery,所有加载eas ...

  9. easyui datagrid使用(好)

    加载相关js和css,因为easyui依赖jquery,所有加载easyui前要先加载jquery,否则为提示找不到datagrid <!-- 加载jquery --> <scrip ...

随机推荐

  1. log4cplus的安装与使用初步

    1. 简单介绍 log4cplus是C++编写的开源的日志系统,The purpose of this project is to port the excellentLog for Java (lo ...

  2. linux 下处理大文件

    .head tail more .先把大文件进行分割 split split 参数: -a, --suffix-length=N 指定输出文件名的后缀,默认为2个 -b, --bytes=SIZE 指 ...

  3. 执行pig出错Unhandled internal error. Found interface jline.Terminal, but class was expected

    执行pig时报例如以下错误 2015-07-14 10:41:12,869 [main] ERROR org.apache.pig.Main - ERROR 2998: Unhandled inter ...

  4. ubuntu PATH 出错修复

    我的 ubuntu10.10设置交叉编译环境时,PATH 设置错误了,导致无法正常启动,错误情况如下: { PATH:找不到命令ubuntu2010@ubuntu:~$ ls命令 'ls' 可在 '/ ...

  5. ubuntu 命令行下查看网页 w3m

    w3m localhost/index.php

  6. 自增长主键Id的设计

    http://www.cnblogs.com/lhking/p/3945865.html

  7. nodejs 的好基友:pm2

    安装:npm install pm2 -g #全局安装pm2 查看版本:pm2 -v 自动重启: pm2 start hello.js --watch 查看列表:pm2 list 查看日志: pm2 ...

  8. java中GET方式提交和POST方式提交

    java中GET方式提交的示例: /** * 获取关注列表; * @return */ @SuppressWarnings("unchecked") public static A ...

  9. Informix 配置选项

    下表列出了用于改善数据库性能的附加选项.如果选择在 onconfig 配置文件中进行更改,则需要重新启动 Informix 通用服务器.可以在 Informix 服务器处于联机或脱机状态时编辑 onc ...

  10. SQL Server 2008、SQL Server 2008R2 自动备份数据库

    让SQL Server 2008自动备份数据库,需要建立一个SQL Server作业,并启动SQL Server代理,使该作业定期运行. 具体来说,可以按以下步骤进行: 一.打开SQL Server ...