EasyUI的doCellTip实现鼠标放到单元格上提示单元格
网络编程 2021-07-04 20:00www.168986.cn编程入门
本篇文章主要介绍了easyUI的doCellTip 就是鼠标放到单元格上有个提示的功能,对于Javascript教程感兴趣的同学可以参考一下
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({ : (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></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:
onLoadSuess:function(data){ $('#dg').datagrid('doCellTip',{cls:{'background-color':'red'},delay:1000}); }
以上所述是长沙网络推广给大家介绍的EasyUI的doCellTip实现鼠标放到单元格上提示单元格内容,希望对大家有所帮助,如果大家有任何疑问请给我留言,长沙网络推广会及时回复大家的。在此也非常感谢大家对狼蚁SEO网站的支持!
编程语言
- 宿迁百度关键词排名指南:实现精准营销的关键
- 四川SEO优化怎么做网络推广
- 立昂技术备案老域名收购:如何为您的业务赋能
- 安徽百度关键词seo贵不贵,一般需要多少钱
- 吉林百度快照排名怎么做电话营销
- 多伦新手做SEO怎么做
- 甘肃优化关键词排名推广怎么做论坛营销
- 沙雅SEO网站推广:提升您的在线可见性
- 四川SEO优化如何提升销售额和销售量
- 聂荣网站排名优化:提升网站可见性的全方位指
- 涞水SEO:提升地方企业在线可见性的策略
- 辽宁百度seo排名怎样做网站排名
- 临湘哪有关键词排名优化:提升网站可见度的关
- 黑龙江百度网站优化有没有优惠
- 凉城优化关键词排名推广:提升您的网络可见性
- 萝北整站优化:提升您网站流量和排名的全面指