You are not logged in.
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.
Pages: 1
Topic closed
I have e problem with CellAfterEditEventArgs
AddHandler sheet1.CellEditTextChanging, AddressOf GSheet_afterTextChanging
Private Sub GSheet_afterCellEdit(ByVal sender As Object, ByVal e As CellAfterEditEventArgs)
Dim cell As ReoGridCell = e.Cell
Dim valeur As String
valeur = sheet1.GetCellData(cell.Address)
End Sub
Valeur is the text BEFORE editing and not After
How to do for have the value after editing?
Best regards
Maurice
Offline
The event argument has the new data.
e.NewData
Offline
It's works thank
Offline
it'works for editing by keyboard but not when a drop-down modified a cell
AddHandler sheet1.CellDataChanged, AddressOf GSheet_CellDataChanged
Private Sub GSheet_CellDataChanged(ByVal sender As Object, e As CellEventArgs)
Dim cell As ReoGridCell = e.Cell
Dim valeur As String
valeur = e.Cell.Data
End Sub
this event is not activated by a drop-down cell?
Offline
No it doesn't work for drop-down list cell. If you need new data, the e.Cell.Data is it.
If you need old data, below is a work-through.
1. Create a custom cell body inherited from DropdownListCell
2. Override the OnSetData method
class MyDropdownListCell : DropdownListCell
{
public override object OnSetData(object data)
{
var oldData = this.Cell.Data;
var newData = data;
return base.OnSetData(data);
}
}
3. Use this custom list cell instead of the built-in one
var listCell = new MyDropdownListCell();
listCell.Items.AddRange(new string[] { "AAA", "BBB", "CCC" });
sheet["A1"] = listCell;
4. Get the new data and old data from OnSetData method
...
var oldData = this.Cell.Data; // null
var newData = data; // 'AAA'
...
Be careful to change the new data in OnSetData method, that will make the cell data different from the drop-down list displayed. That's also why drop-down list doesn't raise AfterCellEdit event, which can abort the edit and restore to original data.
Offline
Great it's work
ReoGrid is a powerfull grid
Offline
Thanks!
Offline
Pages: 1
Topic closed