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 ...
随机推荐
- PowerDesigner 使用小结
这里总结一篇关于数据建模工具 PowerDesigner 的使用小技巧,下面列出的两个应用场景要在网上现找解决方案的话还真不一定好找,所以选择将这两个棘手的问题先记下来. 1. PDM 中表间关系出现 ...
- Maven多镜像配置
Maven阿里云镜像相信国内用得是很爽的,但有时候,一些版本的包明明可以在http://mvnrepository.com上搜索到.但你确实下载不来... 废话不多,settings.xml多镜像配置 ...
- MongoDB基础笔记
MongoDB show dbs 查看当前的数据库 use test 选库 show tables/collections 查看当前库下的文档 db.help() 查看帮助 db.createColl ...
- 【集成模型】Bootstrap Aggregating(Bagging)
0 - 思想 如下图所示,Bagging(Bootstrap Aggregating)的基本思想是,从训练数据集中有返回的抽象m次形成m个子数据集(bootstrapping),对于每一个子数据集训练 ...
- NewLife.XCode 上手指南
想了解什么是XCode 在这里我不对XCode做过多介绍,XCode曾经是一个轻量级ORM组件,现在是一个重量级数据映射框架,支持实体对象数据到不同媒体的数据映射,提供面向对象的方式操作数据库,解决9 ...
- osg机械臂模拟
实现自由旋转
- web端安全测试工具
https://www.cnblogs.com/ios9/p/7692373.html 十大web安全扫描工具 扫描程序可以在帮助造我们造就安全的Web 站点上助一臂之力,也就是说在黑客“黑”你之前, ...
- node节点扩容
node节点扩容: 安装docker 部署 kubelet组件 拷贝admin.conf 拷贝bootstrap.conf 安装cni网络插件 拷贝ca.pem 证书,配置kubelet-config ...
- 【Leetcode_easy】671. Second Minimum Node In a Binary Tree
problem 671. Second Minimum Node In a Binary Tree 参考 1. Leetcode_easy_671. Second Minimum Node In a ...
- python之bytes和string相互转换
来源:https://www.cnblogs.com/skiler/p/6687337.html 1.bytes主要是给计算机看的,string主要是给人看的 2.中间有个桥梁就是编码规则,现在大趋势 ...