Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
703
Identify if the data row has changes
posted

Hi,

We are using Ultra grid v9.2 for our application. The grids we are using in our screens are editable. The data would be fetched from the backend and will be populated in the editable grid. When only the user makes some changes in the row they are to be sent to the backend for updating. When the user changes some value in row and hit the enter key in the keyboard we are to check if any of the values in the grid has changed, only then we need send it to the backend. We used the row.DataChanged property for this purpose but it is not working as expected. If the user edits a cell with the same value as the previous one (say a cell has value ‘A’ and then it is edited and the new value is also ‘A’) then the DataChanged is set to true which doesn’t suite our requirement. Is there any other way we could determine if any of the values in the row has been update with the new value. The AfterRowUpdate event works fine when the focus of that row is changed to another row. We need a similar thing even when the focus lies within a same row. Is it possible in ultragrid? We are using ultradatasource as the datasource for the grid. Some please advice. Thanks for your help in advance.

  • 469350
    Offline posted

    The grid track whenever the user makes a change to the data. It does not track if that change is actually different than the underlying value in the DataSource. So if you need to track changes on that level, you will need to write code to do it.

    One way to achieve this would be to compare the values in the UltraDataSource to the values in the back end.

    Another way would be to trap an event of the grid, like BeforeRowActivate or BeforeEnterEditMode and then store the values of the row or cell in a variable. Then when you go to save the changes you can compare the original value you stored against the current value of the cell to see if it changed.

    A third option would be to use a DataSet/DataTable instead of UltraDataSource. UltraDataSource is more efficient, generally speaking, but the DataTable has functionality to track changes built-in.