一、雙擊java
var dblGrid = new Ext.grid.GridPanel({ } dblGrid.addListener('rowdblclick', rowdblclickFn); function rowdblclickFn(grid, rowindex, e){ grid.getSelectionModel().each(function(rec){ alert(rec.get(fieldName)); //fieldName,記錄中的字段名 }); }
二、單擊code
var cb = new Ext.grid.RowSelectionModel({ singleSelect:true //若是值是false,代表能夠選擇多行;不然只能選擇一行 }); var rowGrid = new Ext.grid.GridPanel({ } rowGrid.addListener('rowclick', rowclickFn); function rowclickFn(grid, rowindex, e){ grid.getSelectionModel().each(function(rec){ alert(rec.get(fieldName)); //fieldName,記錄中的字段名 }); }