You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何隐藏jqGrid中的悬浮提示信息?

解决jqGrid单元格按钮悬浮提示隐藏问题
  • 直接在按钮生成时取消title属性
    如果你是通过formatter自定义生成单元格按钮,构造按钮元素时不要设置title属性,或者显式把title设为空字符串就行。示例代码:

    formatter: function(cellValue, options, rowData) {
        // 不带title的按钮
        return '<button type="button" class="btn-operate">操作</button>';
        // 要是原有代码带title,直接清空:
        // return '<button type="button" class="btn-operate" title="">操作</button>';
    }
    
  • 针对jqGrid自带操作按钮的处理
    要是用的是jqGrid内置的actions格式化器生成的编辑、删除按钮,可通过cellattr属性在单元格加载时清空按钮的title:

    colModel: [
        // 其他列配置
        {
            name: 'operate',
            formatter: 'actions',
            cellattr: function(rowId, cellValue, rowObject) {
                // 利用onload事件移除按钮的title
                return 'onload="$(this).find(\'.ui-pg-div, button\').removeAttr(\'title\');"';
            }
        }
    ]
    
  • 批量移除所有单元格按钮的提示
    可以在jqGrid加载完成后,用jQuery批量找到所有单元格里的按钮,移除它们的title属性:

    // 替换成你的jqGrid表格ID
    $("#yourGridId").on("loadComplete", function() {
        $(this).find("td button, td .ui-pg-div").removeAttr("title");
    });
    

内容的提问来源于stack exchange,提问作者King Henry

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 10:55:22