EXTJS4:如何为grid某一个单元格增加提示框

测试环境 ext-4.1.0-gpl

运行效果:

 

Ext.onReady(function () {    
    Ext.tip.QuickTipManager.init(); 
    Ext.widget('grid', {
        title: 'Users',
        store: {
            fields: ['name', 'email', 'comment'],
            data: [
                { 'name': 'Lisa', 'email': 'lisa@simpsons.com', 'comment': 'some comment' },
                { 'name': 'Bart', 'email': 'bart@simpsons.com', 'comment': 'comment' },
                { 'name': 'Homer', 'email': 'home@simpsons.com', 'comment': 'some very long comment' },
                { 'name': 'Marge', 'email': 'marge@simpsons.com', 'comment': 'some very very 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: Ext.getBody() }); });

 

 

posted @ 2012-10-11 12:10  zdkjob  阅读(4441)  评论(0编辑  收藏  举报