首页 > 代码库 > easyui Datagrid添加ToolTips

easyui Datagrid添加ToolTips

1.首先添加 onl oadSuccess事件

data-options="onLoadSuccess:onLoadSuccess"

2. 表格中各个TD单元格添加mouseover事件

  function onl oadSuccess(data) {
            var panel = $(‘#gvList‘).datagrid(‘getPanel‘).panel(‘panel‘);
            panel.find(".datagrid-view2").find(‘.datagrid-btable tr>td‘).mouseover(function(e) {
                var index = $(this).parent().attr("datagrid-row-index");
                var row = $(‘#gvList‘).datagrid(‘getRows‘)[index];
                var content = "消息接受者:<font color=‘red‘>" + row.called + "</font>";
                content += "<br>消息内容:<font color=‘red‘>" + row.content + "</font>";
                content += "<br>发送结果:<font color=‘red‘>" + row.send_result + "</font>";
                $(this).tooltip({ content: content, trackMouse: true }).tooltip(‘show‘);
            });
        }

easyui Datagrid添加ToolTips