Easy ui DataGrid 列文字多串行问题解决方案
nowrap: true, onLoadSuccess: function (data) { $(this).datagrid('doCellTip', { 'max-width': '700px', 'delay': 500 }); }, //更改easy ui datagrid属性 // $(this).datagrid('doCellTip', { 'max-width': '700px', 'delay': //500 }); 是easy ui datagrid扩展

/** datagrid增加ToolTip */ $.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({ top: (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': '2px', '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 id='celltip'></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); //showTip(options, this, e); options.tipDelayTime = setTimeout(function () { showTip(options, that, e); }, params.delay); } }); }); } }); }, /** * 关闭消息提示功能 * * @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; } }); } }); // easy ui datagrid 扩展方法如上
作者:Elite.net
出处:http://www.cnblogs.com/yhyjy/
新浪微博:http://weibo.com/u/2709913775
世上本无垃圾,所谓垃圾是你放错了地方!
每天积累一点点,那么理想便会距离我们越来越近!
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
出处:http://www.cnblogs.com/yhyjy/
新浪微博:http://weibo.com/u/2709913775
世上本无垃圾,所谓垃圾是你放错了地方!
每天积累一点点,那么理想便会距离我们越来越近!
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
分类:
Jquery_Easy ui
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?