ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2016-02-23 08:28:07

amvandenberg
Member
Registered: 2016-02-09
Posts: 10

CellDataChanged event not firing when pasting or deleting

I'm trying to update the underlying datastructure when the user is editing and doing that by hooking onto the CellDataChanged event.
This works fine when the user is editing the cell and commits the value, but it doesn't fire the event when deleting a cell's value or a range of cells by focusing on the cells and hitting the Delete key (RemoveRangeDataAction) or pasting (SetPartialGridAction). Then hitting Ctrl+z (Undo) actually does fire the events, but the Redo fires only when the original action fired the event (seems logical).

It would be nice if the CellDataChanged is fired whenever the cell's data has changed :-).

I tried v1.1.0 for this and the problem is there as well.

Kind regards,

am

Offline

#2 2016-02-24 05:11:59

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: CellDataChanged event not firing when pasting or deleting

Thanks, you're right. There is another event named RangeDataChanged for range data changing, which will be fired when deleting cells data from worksheet. For the pasting, event AfterPaste may be helpful.

But as you pointed out, it should be nicer if just single event firing whenever the cells data changed. We think currently the CellDataChanged fired when deleting or pasting that causes the performance problem, because it is necessary to fire the event for every cells. However we want to measure the performance affect, or consider to add a setting or flag that allows user to enable CellDataChanged for anything.

What do you think?

Edit: An example code that merges three events:

{
  sheet.CellDataChanged += (s, e) => OnRangeDataChanged(e.Cell.PositionAsRange);
  sheet.RangeDataChanged += (s, e) => OnRangeDataChanged(e.Range);
  sheet.AfterPaste += (s, e) => OnRangeDataChanged(e.Range);
}

private void OnRangeDataChanged(RangePosition r)
{
  MessageBox.Show(r.ToAddress());
}

Last edited by Jingwood (2016-02-24 05:47:52)

Offline

#3 2016-02-25 08:39:50

amvandenberg
Member
Registered: 2016-02-09
Posts: 10

Re: CellDataChanged event not firing when pasting or deleting

Ah, thank you. I'm going to try that. I can imagine that firing the CellDataChanged for every cellchange might lead to performance problems in large datagridw ith large operations. Thanks again!

Offline

Board footer

Powered by FluxBB