extjs添加鼠标提示——如何给Grid、ComboBox添加title

效果图:

grid:


表格这个很简单,只要在它的columns里面添加render属性即可。

详见代码:

{
header: "出版社",
dataIndex: 'infoPublisher',
width: 100,
        renderer:function(value,metadata,record,rowIndex,colIndex,store){    
             metadata.attr = "title=" + value;
             return value;  
       },

}




combox:



下拉框代码:

            xtype:"combo",
            width:150,
            id:"sellerCombo",
            displayField:"infoName",
            valueField:"infoCode",
            typeAhead:true,
            triggerAction:"all",
            editable:true,
            hideTrigger:false,
            emptyText:'请选择书商',
            tpl:'<tpl for="."><div class="x-combo-list-item" title="{infoName}" ext:qtitle="title" ext:qtip="{infoName} : {infoCode} tip" >{infoName}</div></tpl>',


再看下API文档的介绍:



其实就是改写(覆盖)他自带的html,通过 tpl 属性我们给每个节点标签插入了 title 属性!



posted @ 2017-06-15 15:12  Mr.Kay  阅读(420)  评论(0编辑  收藏  举报