0
点赞
收藏
分享

微信扫一扫

Easyui datagrid列中使用tooltip

列定义:

{ field: 'test', title: '测试', width: 220, align: "center",
    formatter: function(value, row, index) {
        var oldValue = value;
        if (value.length>=22) {
            oldValue = value.substring(0,19) + "...";
        }
        var content = '<a href="#" title="' + value + '" class="test">' + oldValue + '</a>';
        return content;
    }
}

列定义就是这样定义了,但单纯这样定义是没用的,需要在列表生成后再去启用tooltip,也就是在onLoadSuccess里:

onLoadSuccess:function(data){
    $(".test").tooltip(
            {
                onShow: function(){
                    //设置css
                    $(this).tooltip('tip').css({
                        width:'200',
                        boxShadow: '1px 1px 3px red'
                    });
                    //不设置css
                    //$(this).tooltip('tip')
                }
            }
    );
}
举报

相关推荐

0 条评论