我想用 SlickGrid 模仿电子表格的特定行为。用户:
- 单击单元格以激活它
- 输入
=sum(
,或任何公式, - 原始单元格地址已保存
- 用户选择单元格范围(我假设原始单元格关闭了编辑器)
- 焦点返回到原始单元格,并附加了新的单元格范围。即=总和(r1c1,r2c2)。
让我失望的是需要改变焦点。
var cell_with_formula = null;
grid = new Grid($("#myGrid"), data, columns, options);
// save original cell address, but there is no onBlur event
grid.onBlur = function(args){
cell_with_formula = args; // save address
};
grid.onCellRangeSelected = function(){
if(cell_with_formula){
// check if cell_with_formula has `=` at begining
// if so, append selected range
cell_with_formula = null;
}
};
提前致谢!