Fire event on cell change

Posted by: phillan on 8 September 2017, 1:20 pm EST

  • Posted 8 September 2017, 1:20 pm EST


    I am trying to build a spread with data from 3 different datatables, only one table can be directly bound to a cellrange. The other 2 tables are reorganized in to new tables, one table is vertical with the original columns displayed in rows, and then bound to a cell range. My problem appears when updating the data in a cell in the spread, I want to get an event to fire when a cell in the reorganized table is changed to be able to edit the value in the table connected to the database, in a typed DataSet connected to the database.

    I had an idea of adding a class to each cell in the reorganized table, containing a value, a row index and a column index (the indexes from the table in the typed DataSet). The idea was to edit the value member in this class every time a value is changed in the spread and then propagate this value to the original table in the typed DataSet and the class holds the row and column for the value.

    I tried to do this in the ColumnChanged event on the reorganized table but couldn't get it to fire, even after calling the AcceptChanges method on the reorganized table.

    What methods in the spread can fire the ColumnChanged event on the DataTable, i.e. how can I commit the datatable? Is it possible to use a custom CellType to add the indexes from the original table directly in the spread?

    I need to keep track of these indexes because the spread should be sortable in several different ways, both by rows and columns, and I still need to know where in the original DataTable to change the values.

    I hope someone can understand my discription and my thinking... ;o)


  • Replied 8 September 2017, 1:20 pm EST


    When you make changes in the Spread, the changes are also made in the bound DataSource. However, this is not updated until you click off the row onto another row. Or, when you call the EndEdit method on the bound DataRow. If you need to know when a change has been made in the Spread, you can map the DefaultSheetDataModel's Changed event.

    If you want to create a custom CellType in a bound Spread, this is possible. You just need to set the DataAutoCellTypes property of the Spread to False to keep the binding to a DataSOurce from overwriting the CellType property to the default for the bound DataColumn.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels