datagrid.celltips.js
/**
* 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的更多相关文章
- easyui的datagrid用js插入数据等编辑功能的实现
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- datagrid后台分页js.js
$(function () { gridbind(); bindData(); }); //表格绑定function gridbind() { $('#dg').datagrid({ title: ' ...
- datagrid后台分页js
$(function () { gridbind(); bindData(); }); //表格绑定function gridbind() { $('#dg').datagrid({ title: ' ...
- DevExtreme学习笔记(一) DataGrid中js分析
1.overviewjs采用 $(function() { $("#gridContainer").dxDataGrid({ dataSource: { store: { type ...
- 基于1.3.3版本tooltip的datagrid单元格tip实现
基于1.3.3版本tooltip的datagrid单元格tip实现 2013年05月25日 ⁄ datagrid ⁄ 共 6122字 ⁄ 评论数 26 ⁄ 被围观 7,033 views+ 文章目录 ...
- RDIFramework.NET框架Web中datagrid与treegrid控件自动生成右键菜单与列标题右键菜单
在实际应用中常可以看到数据展示控件有右键菜单的功能,对应的列标题也可以右键弹出快捷菜单设置指定列的显示与隐藏等功能.在我们的RDIFramework.NET Web框架中,只要是使用了EasyUI的D ...
- easyloader.js源代码分析
http://www.cnblogs.com/jasonoiu/p/easyloader_source_code_analysis.html Jquery easyui是一个javascript UI ...
- easyui datagrid使用
http://www.cnblogs.com/zgqys1980/archive/2011/01/04/1925775.html 加载相关js和css,因为easyui依赖jquery,所有加载eas ...
- easyui datagrid使用(好)
加载相关js和css,因为easyui依赖jquery,所有加载easyui前要先加载jquery,否则为提示找不到datagrid <!-- 加载jquery --> <scrip ...
随机推荐
- How to change in the Cocos2d-x project from landscape to portrait both in iOS and Android
iOS: This is done using XCode project details (select the required orientation) Android: AndroidMani ...
- iOS kvo 结合 FBKVOController 的使用
iOS kvo 结合 FBKVOController 的使用 一:FBKVOControlloer是FaceBook开源的一个 在 iOS,maxOS上使用 kvo的 开源库: 提供了block和@s ...
- spring测试实例
我们以前要进行单元测试,必须先得到ApplicationContext对象,再通过它得到业务对象,非常麻烦,重复代码也多.基于spring3的单元测试很好的解决了这个问题 基于spring3的单元测试 ...
- HDU 1565 1569 方格取数(最大点权独立集)
HDU 1565 1569 方格取数(最大点权独立集) 题目链接 题意:中文题 思路:最大点权独立集 = 总权值 - 最小割 = 总权值 - 最大流 那么原图周围不能连边,那么就能够分成黑白棋盘.源点 ...
- js dom获取
let inputs = this.$el.querySelectorAll('input'); let icon = this.$el.querySelector('.el-input__icon' ...
- com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "ExceptionId"
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "Exception ...
- 不能使用控制器“XXXController”的单个实例处理多个请求。如果正在使用自定义控制器工厂,请确保它为每个请求创建该控制器的新实例。
原因:应用@{Html.RenderAction("aaa","XXX");}时路径路由和动作控制器不能是相同的,不然会的错. 比如:http://localh ...
- java线程-synchronized实现可见性代码
以下是一个普通线程代码: package com.Sychronized; public class SychronizedDemo { //共享变量 private boolean ready=fa ...
- Hadoop + HBase (自带zookeeper 也可单独加) 集群部署
Hadoop+HBase搭建云存储总结 PDF http://www.linuxidc.com/Linux/2013-05/83844.htm HBase 结点之间时间不一致造成regionserve ...
- 【小程序】微信小程序之地图功能
转载请注明出处:http://blog.csdn.net/crazy1235/article/details/55004841 基本使用 地图组件使用起来也很简单. .wxml <map id= ...