【问题标题】:How to add Tooltip to jqgrid如何将工具提示添加到 jqgrid
【发布时间】:2011-06-06 00:37:36
【问题描述】:

我正在使用 jqgrid 显示服务器中存在的数据我如何在鼠标悬停工具提示上显示数据描述。

在 jqgrid 上显示工具提示的最佳方式是什么?

【问题讨论】:

    标签: jqgrid tooltip


    【解决方案1】:

    鼠标悬停时 jqGrid 中显示的工具提示只不过是相应 HTML 元素的“标题”属性。如果您想使用setCell 更改工具提示:

    $("#list").setCell(rowid,'Name','','',{'title':'my custom tooltip on cell'});
    

    'Name' 是设置工具提示的列名,rowid 标识行。更多信息请阅读this answer,包括参考资料。

    【讨论】:

      【解决方案2】:
        var setTooltipsOnColumnHeader = function (grid, iColumn, text){
            var thd = jQuery("thead:first", grid[0].grid.hDiv)[0];  
            jQuery("tr.ui-jqgrid-labels th:eq(" + iColumn + ")", thd).attr("title", text);
           };
      
      
      and just set tooltip on header column
      
      setTooltipsOnColumnHeader ($("#empgrid"), 4, "Invoice No");
      setTooltipsOnColumnHeader ("GRID NAME", "COLUMN" , "TOOLTIP TEXT");
      

      【讨论】:

      • 对于标题元素的工具提示,您可以使用setLabel。该调用的签名类似于setCell,只是您没有指定rowid。示例:$("#ajaxGrid").setLabel('Name', '', '', { 'title': "Project Name" });
      猜你喜欢
      • 2010-11-12
      • 1970-01-01
      • 2019-01-04
      • 2012-11-02
      • 2017-08-03
      • 2017-06-03
      • 2022-01-07
      • 1970-01-01
      相关资源
      最近更新 更多