Ext 中 对 grid cell 单元 鼠标移入移出显示隐藏弹窗

1,效果如下


2,在grid的单元格上设置的listeners onmouseleave 不起作用 就用了js的onmouseeleave 代码如下

/**
 * Created by Sukla on 2018/1/8.
 */
Ext.define('GridCellToggleTipsView',{
    extend:'Ext.grid.Panel',
    alias:'widget.gridCellToggleTipsView',
    controller:'gridCellToggleTipsController',
    cls: 'myview-order-management myview-show-tip',
    store:Ext.create('Ext.data.Store',{
        data:[
            {
                name:'苏格拉桂',
                age:30
            },
            {
                name:'Sukla',
                age:2
            },
            {
                name:'GSZH',
                age:5
            }
        ]
    }),
    columns:{
        defaults:{
            flex:1
        },
        items:[
            {
                text:'姓名',
                dataIndex:'name',
                renderer:function(value){
                    return '<p style="padding:0;margin:0" οnmοuseοver="showTips(this)" οnmοuseleave="hideTips(this)">' + value + '</p><div class="my-gridtip my-gridtip-hide"></div>'
                }
            },
            {
                text:'年龄',
                dataIndex:'age'
            }
        ]
    }

})
var showTips=function(item){
    var text=item.textContent;
    var tpl = new Ext.XTemplate(
        '<tpl for=".">',
        '<tpl if="sucstate">',
        '<div class="xtemplate-view-order-management sucstate">',
        '</tpl>',
        '<tpl if="!sucstate">',
        '<div class="xtemplate-view-order-management">',
        '</tpl>',
        '<p class="xtemplate-item xtemplate-item-view-title">{address}</p>',
        '<p class="xtemplate-item xtemplate-item-view-index">{[xindex]}</p>',
        '<p class="xtemplate-item">{birthday}</p>',
        '<div class="xtemplate-item xtemplate-item-view-statetext">{includetext}</div>',
        '</div>',
        '</tpl>'
    )
    var data={
        items:[
            {
                address:'法海寺底',
                birthday:'19940108',
                includetext:'代码抄袭',
                sucstate:true
            },
            {
                address:'香炉峰顶',
                birthday:'20170808',
                includetext:'夕阳西下',
                sucstate:true
            },
            {
                address:'大马路上',
                birthday:'20180101',
                includetext:'睡到11点',
                sucstate:false
            }
        ]
    }
    tpl.overwrite(item.nextSibling, data.items);
    item.nextSibling.classList.remove("my-gridtip-hide");
}
var hideTips=function(item){
    item.nextSibling.classList.add("my-gridtip-hide");
}
3,css

.myview-order-management .xtemplate-view-order-management{
    display:block;
    float: left;
    width:120px;
    height: 120px;
    word-wrap: break-word;
    background-color: #fff !important;
    background-image: url(images/khjz/icon-line-bg-x-default.png) !important;
    background-size: 12px 9px;
    background-repeat: repeat-x;
    background-position: center 25px;
}
.xtemplate-view-order-management .xtemplate-item{
    padding:0;
    margin:0;
    text-align: center;
    line-height: 20px;
    min-height: 20px;
    color: #666666;
}
.xtemplate-view-order-management.sucstate{
    background-image: url(images/khjz/icon-line-bg-x.png) !important;
}
.xtemplate-view-order-management.sucstate .xtemplate-item{
    color: orange;
}
.xtemplate-item.xtemplate-item-view-title{
    font-size: 15px;
}
.xtemplate-item.xtemplate-item-view-index{
    height: 20px;
    width: 20px;
    margin: 0 auto;
    display: block;
    border-radius: 50%;
    color: #ffffff!important;
    background-color: #aaaaaa !important;
}
.xtemplate-view-order-management.sucstate .xtemplate-item.xtemplate-item-view-index{
    background-color: #22bd7a !important;
}

.xtemplate-item.xtemplate-item-view-statetext{
    width: 120px;
    height: 60px;
    white-space: pre-wrap;
}

.myview-show-tip .my-gridtip{
    position: fixed;
    z-index: 399;
    max-width: 602px;
    min-height: 122px;
    border:1px solid #e5e5e5;
    background-color: #e5e5e5;
    border-radius: 5px;
}
.myview-show-tip .my-gridtip-hide{
    display: none;
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值