SlickGrid 中的单元格工具提示

发布于 2024-09-01 04:49:36 字数 343 浏览 4 评论 0原文

我的 SlickGrid 表格中的某些单元格具有 myClass 类。

我为它们添加了一个工具提示,如下所示:

$(".myClass").hover(// Mouse enters
                    function(e) {...},
                    // Mouse leaves
                    function() {...});

它工作正常,但如果我将表格滚动到底部,然后将其滚动回顶部,工具提示将不再出现。

有人可以建议任何解决方法吗?

谢谢 !

Some cells in my SlickGrid table have myClass class.

I added a tooltip for them like this:

$(".myClass").hover(// Mouse enters
                    function(e) {...},
                    // Mouse leaves
                    function() {...});

It works fine, but if I scroll the table to the bottom, and then scroll it back to the top, the tooltip does not appear anymore.

Can someone suggest any workaround ?

Thanks !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

若能看破又如何 2024-09-08 04:49:36
        grid.onMouseEnter.subscribe(function(e, args) {
            var cell = grid.getCellFromEvent(e)
            var row = cell.row
            var item = dataView.getItem(row);
            //do whatever
        });

        grid.onMouseLeave.subscribe(function(e, args) {
            //do whatever
        });

单元格、行和项目只是如何获取数据的示例

        grid.onMouseEnter.subscribe(function(e, args) {
            var cell = grid.getCellFromEvent(e)
            var row = cell.row
            var item = dataView.getItem(row);
            //do whatever
        });

        grid.onMouseLeave.subscribe(function(e, args) {
            //do whatever
        });

cell, row and item are just examples for how to get to data

心房的律动 2024-09-08 04:49:36

尝试:

$('.myClass').live('mouseover mouseout', function(event) {
 // works only on jQuery 1.4.1 and up
  if (event.type == 'mouseover') {
    // Mouse enters 
  } else {
    // Mouse leaves
  }
});

如果这不起作用,我猜测 .myClass 已被删除,因此请尝试在每个卷轴中再次添加它......

无论哪种方式,请使用 live() >

try:

$('.myClass').live('mouseover mouseout', function(event) {
 // works only on jQuery 1.4.1 and up
  if (event.type == 'mouseover') {
    // Mouse enters 
  } else {
    // Mouse leaves
  }
});

if that doesn't work, I'm guessing .myClass has been remove so try adding it again in every scrolls...

either way, use the live()

枉心 2024-09-08 04:49:36

Slickgrid 有一个插件,可以为太大而无法在单元格中显示的项目显示工具提示(如果这就是您最终想要做的):
SlickGrid:如何查看长单元格条目的全文?

There's a plugin for Slickgrid that will display tooltips for items that are too big to show in a cell (if that's what you're ultimately looking to do):
SlickGrid: how to view full text for long cell entries?

不忘初心 2024-09-08 04:49:36
1. include ../slick/plugins/slick.autotooltips.js
ex)     

    <script src="/jsp/slick/plugins/slick.autotooltips.js"></script>

2. add code

    $.get(url,function(data){

    ...

    grid.registerPlugin( new Slick.AutoTooltips({ enableForHeaderCells:
    true }) );

    ...


more...

use jquery.ui.tooltips

ex)
<link rel="stylesheet" href="/jsp/jui/themes/base/jquery.ui.tooltip.css"/>
<script src="/jsp/jui/ui/jquery.ui.core.js"></script>
<script src="/jsp/jui/ui/jquery.ui.widget.js"></script>
<script src="/jsp/jui/ui/jquery.ui.position.js"></script>
<script src="/jsp/jui/ui/jquery.ui.tooltip.js"></script>

open slick.grid.js and modify function 2436(line)

    function setActiveCellInternal(newCell, opt_editMode) {
      if (activeCellNode !== null) {
        makeActiveCellNormal();
        $(activeCellNode).removeClass("active");
        try{$( document ).tooltip("destroy");}catch(e){}    // <<<< add code
        try{$( document ).tooltip();}catch(e){}         // <<<< add code
        if (rowsCache[activeRow]) {
          $(rowsCache[activeRow].rowNode).removeClass("active");
        }
      }
1. include ../slick/plugins/slick.autotooltips.js
ex)     

    <script src="/jsp/slick/plugins/slick.autotooltips.js"></script>

2. add code

    $.get(url,function(data){

    ...

    grid.registerPlugin( new Slick.AutoTooltips({ enableForHeaderCells:
    true }) );

    ...


more...

use jquery.ui.tooltips

ex)
<link rel="stylesheet" href="/jsp/jui/themes/base/jquery.ui.tooltip.css"/>
<script src="/jsp/jui/ui/jquery.ui.core.js"></script>
<script src="/jsp/jui/ui/jquery.ui.widget.js"></script>
<script src="/jsp/jui/ui/jquery.ui.position.js"></script>
<script src="/jsp/jui/ui/jquery.ui.tooltip.js"></script>

open slick.grid.js and modify function 2436(line)

    function setActiveCellInternal(newCell, opt_editMode) {
      if (activeCellNode !== null) {
        makeActiveCellNormal();
        $(activeCellNode).removeClass("active");
        try{$( document ).tooltip("destroy");}catch(e){}    // <<<< add code
        try{$( document ).tooltip();}catch(e){}         // <<<< add code
        if (rowsCache[activeRow]) {
          $(rowsCache[activeRow].rowNode).removeClass("active");
        }
      }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文