I'm using the bwu-grid and want to have the delete key to delete rows. Here is the code I have right now:
_grid.onKeyDown.listen((e) {
print("onKeyDown ${e.keyCode}");
if(e.keyCode == 46)
{
var rows = _grid.getSelectedRows();
for (var i = 0, l = rows.length; i < l; i++) {
var item = _dataView.getItem(rows[i]);
var rowid = item["id"];
_dataView.deleteItem(rowid);
// This should probably be handled in another event?
_grid.invalidate();
_grid.render();
}
}
});
It works but the problem is that if I enter edit mode on a cell and hit the delete key to delete a character inside the cell then the same code gets run and deletes the whole row. So I guess I need a way to determine if the cell is in edit mode or not. Or maybe I am going about this the wrong way?