EXTJS-GridPanel双击行 事件

var grid = new Ext.grid.GridPanel({
	........,
	listeners:{
            	'rowdblclick' : function(grid, rowIndex, e){
            		grid.getSelectionModel().clearSelections();
            		grid.getSelectionModel().selectRow(rowIndex);
            		// alert(rowIndex+'---'+grid.id);
            	 
			//下面为各种数据的获取方式,总有一种适合你
            		  var record=grid.getSelectionModel().getSelected();
            	 	// alert(grid.getView().getHeaderCell(0).name);
            	 
            		 /*
            		 var row = grid.getView().getRow(rowIndex);
            		 alert(row.get("Name"));
            		 */
            		 /*
            	 	var record=grid.getSelectionModel().getSelected();
            		 alert(record.get('Name'));
            	 	*/
            	 	/*
            	 	grid.getSelectionModel().each(function(rec){   
			     alert(rec); 
			   });
			*/
           	 }
            }
});
 

 关键代码如下:

你可能感兴趣的:(EXTJS)