Extjs中Gridpanel中加每行提示

在使用GridPanel时,在列数量较多或存在备注型信息时,可以通过tip窗体进行每行详细信息的显示,笔者是通过如下方式进行

图例:
Extjs中Gridpanel中加每行提示


ClientProduct_grid.on('render',function (grid)
{
      var store=grid.getStore();
      var view=grid.getView();
      var str="";
      ClientProduct_grid.tip=new Ext.ToolTip({
            target:view.mainBody,
            title:'显示详细信息',
            delegate:'.x-grid3-row',
            trackMouse:true,
            dismissDelay:5000,
            renderTo:document.body,
            listeners:{
                              "beforeshow":function updateTipBody(tip) {
                               var rowIndex=view.findRowIndex(tip.triggerElement);
                                if(store.getAt(rowIndex).get('Pmemo').length==0) {
                                    str='<div style="padding:20px;border:1px solid #999; color:#555; background: #f9f9f9;">'+""+'</div>';
                                    tip.body.dom.innerHTML="";
                                   }else {
                                     str='<div style="padding:20px;border:1px solid #999; color:#555; background: #f9f9f9;">'+store.getAt(rowIndex).get('Pmemo')+'</div>';
                                      tip.body.dom.innerHTML=str;
                                    }
                                   rowIndex=null;
           }
}
});

});
以上代码,其实在API帮助文件中已有,大家可以留意

你可能感兴趣的:(ext,div,gridPanel,tip)