datagrid使用和文字超出tip提示
{onlyShowInterrupt: true,position: 'top',//,//tipStyler: { 'backgroundColor': '#fff000', width: '200px', borderColor: '#ff0000', boxShadow: '1px 1px 3px #292929' },//,//contentStyler: { backgroundColor: '#333', paddingLeft: '5px' }});
{onlyShowInterrupt: true,position: 'top',//,//tipStyler: { 'backgroundColor': '#fff000', width: '200px', borderColor: '#ff0000', boxShadow: '1px 1px 3px #292929' },//,//contentStyler: { backgroundColor: '#333', paddingLeft: '5px' }});其中:doCellTip为easyui内部封装,并非页面需要定义一个id=doCellTip的标签
其他解说查看网站:http://www.zi-han.net/case/easyui/datagrid&tree.html
使用以上代码需要引用js文件datagridTip.js
<script type="text/javascript" src="@Url.Content("~/js/datagridTip.js")"></script>代码如下:
$.extend($.fn.datagrid.methods, {
/**
* 开打提示功能 by xiaoyu
* @param {} jq
* @param {} params 提示消息框的样式
* @return {}
*/
doCellTip: function (jq, params) {
function showTip(showParams, td, e, dg) {
//无文本,不提示。
if ($(td).text() == "") return; params = params || {};
// $(".tipcontent").show(); showParams.content = '<div class="tipcontent">' + 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.content.length > 100) {
tip.css({width:'600px'});
}
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;
// $(".tipcontent").hide();
$(".tooltip.tooltip-top").hide();
// $(".tooltip-arrow-outer").hide();
$(".tooltip-arrow").hide();
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').hide();
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);
}
},
'mouseup': function(e) {
if (options.factContent) {
options.factContent.remove();
options.factContent = null; }
},
'mouseout': function(e) {
if (options.factContent) {
options.factContent.remove();
options.factContent = null; }
},
'mousemove': function(e) {
if (options.factContent) {
options.factContent.remove();
options.factContent = null; }
}
});
});
} else {
if (options.factContent) {
options.factContent.remove();
options.factContent = "";
options.factContent = null;
}
}
});
},
/**
* 关闭消息提示功能
* @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').undelegate('td', 'mouseup');
});
}
});
datagrid使用和文字超出tip提示的更多相关文章
- Table组件设置文字超出宽度显示省略号,鼠标悬停以悬浮框显示
一.设置文字超出宽度显示省略号 注意点: 1. 需要指定column的width属性,否则列头跟内容可能不对齐.需要留一列不设置宽度以适应弹性布局. 2. 列宽度width必须大于ellipsis的 ...
- [js开源组件开发]tip提示组件
tip提示组件 常见的应用场景中,总是难免会遇到提示信息,比如显示不完全时需要鼠标移上去显示title,比如验证时的错误提示,比如操作按钮的辅助说明等,所以我独立出来了一个小的js组件,tip提示组件 ...
- div文字超出
效果一:div文字超出处理 <div style="width:200px; white-space:nowrap;overflow:hidden;text-overflow:elli ...
- bootstrap3.0 模态框显示的文字超出怎么办
版本:bootstrap3.3 模态框文字超出 解决方案: 在html中控制自动换行 其实只要在表格控制中添加一句<div style="word-break:break-all& ...
- 文字超出DIV后,隐藏文字并显示...
<html> <head> <style type="text/css"> #cs{width:100px;height:50px;line-h ...
- td默认文字超出后显示..,点击tr时td文字显示完整
做项目时,产品提的需求,table表格里面,每一列限制文字超出宽度后显示省略号,等点击td时,文字显示完整,今天整理了一下代码,积累一下 备注:1.邮箱和网址,在td里面不会自动换行,需要增加word ...
- easyui combobox下拉框文字超出宽度有横向滚轮
//下拉框显示横向滚轮 $(".combo").mouseenter(function(){ $(this).prev().combobox("showPanel&quo ...
- CSS 之 div中文字超出时自动换行
在开发中很容易遇到div中文字超出的问题,在此总结以下方法: 1. white-space :属性设置如何处理元素内的空白.这个属性声明建立布局过程中如何处理元素中的空白符.所有浏览器都支 ...
- css文字超出自动显示省略号
只针对单行文本有效: 01.针对块状元素 ul li{ width: 180px; text-overflow: ellipsis; white-space: nowrap;/*禁止自动换行*/ ov ...
随机推荐
- 使用Neo4j分析《权力的游戏》
几个月前,数学家 Andrew Beveridge和Jie Shan在数学杂志上发表<权力的网络>,主要分析畅销小说<冰与火之歌>第三部<冰雨的风暴>中人物关系,其 ...
- 超详细Qt5.9.5移植攻略
本文就来介绍下如何将Qt5.9.5移植到ARM开发板上. 以imx6开发板为例,使用Ubuntu14.04虚拟机作为移植环境. 准备工作 1.主机环境:Ubuntu14.04: 开发板:启扬IAC-I ...
- 如何配置 VirtualBox 中的客户机与宿主机之间的网络连接
如何配置 VirtualBox 中的客户机与宿主机之间的网络连接 作者: Aaron Kili 译者: LCTT rusking | 2017-03-01 13:40 评论: 3 收藏: 3 当你 ...
- <JavaScript>几道javascript练习题
问题1: 作用域(Scope) 考虑以下代码: (function() { var a = b = 5; })(); console.log(b); 控制台(console)会打印出什么? 答案 上述 ...
- 006-多线程-集合-Set-ConcurrentSkipListSet
一.简介 ConcurrentSkipListSet是线程安全的有序的集合,适用于高并发的场景.ConcurrentSkipListSet和TreeSet,它们虽然都是有序的集合.但是,第一,它们的线 ...
- proj-6.1.1 编译
Requiring C++11 Requiring C++11 - done Configuring PROJ: PROJ_VERSION = 6.1.1 PROJ_ABI_VERSION = 6_1 ...
- Linux -- PHP-FPM的源码解析和模型
1.进程管理模式 PHP-FPM由1个master进程和N个worker进程组成.其中,Worker进程由master进程fork而来. PHP-FPM有3种worker进程管理模式. 1. Stat ...
- Maven 打war包
使用maven将项目达成war包 右击项目的跟项目,选择run as 选择maven build.... 进入窗口,在 Goals 输入命令 clean package,选择 skip Tes ...
- vue-cli 引入stylus报错
在App.vue页面添加以下代码报错: <style lang="stylus" rel="stylesheet/stylus"> </sty ...
- migrate设置
migrate配置 进入项目manage所在的目录中执行如下命令,否则会报错:no such table: django_session 进入cmd 输入盘符比如:E: 切换目录 cd E:\prog ...