ExtJS Grid Tooltip

function g(){
		var difsAdjustGrid;
		var difsAdjustCm;
		difsAdjustCm = new Ext.grid.ColumnModel(
			[	new Ext.grid.RowNumberer(), 
				{id: 'DASYS_NAME', header : '稽核实例',dataIndex : 'DASYS_NAME',width : 100,sortable : true}
				,{id: 'DADIFF_NAME', header : '差异形态名称',dataIndex : 'DADIFF_NAME',width : 100,sortable : true}
				,{id: 'DADIFF_DESC', header : '差异形态描述',dataIndex : 'DADIFF_DESC',width : 100,sortable : true, hidden: true}
				,{id: 'NODE_NAME', header : '部门',dataIndex : 'NODE_NAME',width : 100,sortable : true}
				,{id: 'DATA_BATCH', header : '比对批次',dataIndex : 'DATA_BATCH',width : 100,sortable : true}
				,{id: 'LAST_DIFFREC', header : '上期异常',dataIndex : 'LAST_DIFFREC',width : 100,sortable : true}
				,{id: 'ABN_COUNT', header : '本期异常',dataIndex : 'ABN_COUNT',width : 100,sortable : true,tooltip:'本期异常=本期新增+历史待分析+历史待整改'}
				,{id: 'qjycjs', header : '期间异常减少',dataIndex : 'qjycjs',width : 150,sortable : true,tooltip:'期间异常减少=上期异常+本期新增-本期异常-期间异动'}
				,{id: 'NEW_COUNT', header : '本期新增',dataIndex : 'NEW_COUNT',width : 100,sortable : true}
				,{id: 'ANALY_COUNT', header : '历史待分析',dataIndex : 'ANALY_COUNT',width : 120,sortable : true}
				,{id: 'UPDATE_COUNT', header : '历史待整改',dataIndex : 'UPDATE_COUNT',width : 120,sortable : true}
				,{id: 'CHANGE_COUNT', header : '期间异动',dataIndex : 'CHANGE_COUNT',width : 100,sortable : true}
			]);
		
		var difsAdjustStore = new Ext.data.Store({
			proxy: new Ext.data.HttpProxy({
				url: '/dwrap/result/getSummaryDataListResultAction.action'
				,method: "POST"
			}),
			baseParams: {
				"criteria.batch": batch
				,"criteria.daitemSn": daitemSn
			}
			,reader: new Ext.data.JsonReader({
				root: 'resultList',
				totalProperty: 'total',
				fields: [
					'DASYS_NAME'
					,'NODE_NAME'
					,'DATA_BATCH'
					,'LAST_DIFFREC'
					,'ABN_COUNT'
					,'qjycjs'
					,'NEW_COUNT'
					,'ANALY_COUNT'
					,'UPDATE_COUNT'
					,'CHANGE_COUNT'
					,'DADIFF_NAME'
					,'DADIFF_DESC'
				]
			})
			, autoDestroy: true
		});

		difsAdjustStore.load({params:{start:0, limit:20}});
		/*var myData = [
	        ['CRM与HLR与计费用户','长沙','20100615','2010-06-15',12,22,12,12,32,14,15,18],
	        ['CRM与HLR','娄底','20100615','2010-06-25','crm',13,14,15,16,12,16,16]
	    ];
	    
	    
	    var difsAdjustStore = new Ext.data.ArrayStore({
	        fields: [
	           {name: 'jhsl',type:'text'},
	           {name: 'ds', type: 'text'},
	           {name: 'dbpc', type: 'text'},
	           {name: 'cjrq', type: 'text'},
	           {name: 'sqyc', type: 'text'},
	           {name: 'bqyc', type: 'text'},
	           {name: 'qjycjs', type: 'text'},
	           {name: 'bqxz', type: 'text'},
	           {name: 'lsdfx', type: 'text'},
	           {name: 'lsdzg', type: 'text'},
	           {name: 'qjyd', type: 'text'},
	           {name: 'sjy', type: 'text'},
	           {name: 'sjy', type: 'text'},
	           {name: 'sjy', type: 'text'},
	        ]
	    });
	    
	    difsAdjustStore.loadData(myData);
	    */
	    
		difsAdjustGrid = new Ext.grid.GridPanel({
			id: 'difsAdjustGrid',
			title:'CRM、HLR、计费用户数比对',
			region : 'center',
			height:315,
			border:false,
			cm : difsAdjustCm,
			ds : difsAdjustStore,
			autoScroll : true,
			layout : 'fit',
			viewConfig: {
	            columnsText: '显示的列',
	            //scrollOffset: 30,
	            sortAscText: '升序',
	            sortDescText: '升序',
	            forceFit: true
	        },
			loadMask: {msg: '正在加载数据, 请稍等...'},
			bbar : new Ext.PagingToolbar({
							store : difsAdjustStore,
							displayInfo : true,
							autoWidth:true,
							bodyStyle:"padding:0px;",
							displayMsg : '当前显示 {0} - {1}条,共 {2} 条',
							emptyMsg : "没有可显示项"
			}),
			listeners: {
				render: function(grid){
					var store = grid.getStore(); 
					var view = grid.getView();
					difsAdjustGrid.tip = new Ext.ToolTip({     
				        target: view.mainBody,    // The overall target element.     
				     
				        delegate: '.x-grid3-row', // Each grid row causes its own seperate show and hide.     
				     
				        trackMouse: true,         // Moving within the row should not hide the tip.     
				     
				        renderTo: document.body,  // Render immediately so that tip.body can be referenced prior to the first show.     
				     
				        listeners: {              // Change content dynamically depending on which element triggered the show.     
				     
				            beforeshow: function updateTipBody(tip) {     
				                   var rowIndex = view.findRowIndex(tip.triggerElement);
				                   tip.body.dom.innerHTML = store.getAt(rowIndex).get("DADIFF_DESC") || "";
				            }     
				        }     
				    });
				}
			}
		});
		return difsAdjustGrid;
	}


 

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页