本帖最后由 liucy 于 2020-9-24 17:57 编辑
var listview=Forguncy.Page.getListView("表格1");
var spread=listview.getControl();
var sheet = spread.getActiveSheet()
sheet.bind(GC.Spread.Sheets.Events.SelectionChanged, function(a,b){
console.log(b);
var row=b.sheet.getActiveRowIndex()+1;
var col=b.sheet.getActiveColumnIndex()+1;
var val=listview.getValue(row-1,col-1); //获取选中的单元格的值
var colName=b.sheet.getValue(0, b.sheet.getActiveColumnIndex(),
GC.Spread.Sheets.SheetArea.colHeader);
Forguncy.Page.getCell("hang").setValue(row);
Forguncy.Page.getCell("lie").setValue(col);
Forguncy.Page.getCell("biaoti").setValue(colName);
Forguncy.Page.getCell("zhi").setValue(val);
}
);
借用论坛中代码,增加了红色的两行,可以实现获取选中的单元格的值
|