Ext.js中的tip事件实际使用

Ext.onReady(function () {
        // Init the singleton.  Any tag-based quick tips will start working.
        Ext.tip.QuickTipManager.init();
        Ext.widget('grid', {
            title: 'Users',
            store: {
                fields: ['name', 'email', 'comment'],
                data: [
                    { 'name': '张三', 'email': 'aaaaaaaaaa.com', 'comment': 'some comment' },
                    { 'name': '李四', 'email': 'bbbbbbbbbb.com', 'comment': 'comment' },
                    { 'name': '王五', 'email': 'cccccccccc.com', 'comment': 'some very long comment' },
                    { 'name': '马六', 'email': 'dddddddddd.com', 'comment': 'some very very  long comment' }
                ]
            },
            columns: [
                { header: 'Name', dataIndex: 'name', width: 100 },
                { header: 'Email', dataIndex: 'email', width: 150 },
                {
                    header: 'comment',
                    dataIndex: 'comment',
                    flex: 1,
                    renderer: function (value, meta, record) {
                        var max = 15;
                        meta.tdAttr = 'data-qtip="' + value + '"';
                        return value.length < max ? value : value.substring(0, max - 3) + '...';
                    }
                }
            ],
            width: 400,
            renderTo: 'output'
        });
    });

 

grid中的显示:

初始化:

Ext.tip.QuickTipManager.init();

判断:

if (columns[i].tooltipType && columns[i].tooltipType === 'qtip') {
                    columns[i].renderer = function (value, meta, record) {
                        meta.tdAttr = 'data-qtip="' + value + '"';
                        return value;
                    }
                }

 

posted @ 2016-09-18 17:01  雪?  阅读(616)  评论(0编辑  收藏  举报