Current filter:
                                You should refresh the page.
                                  • Hello,
                                    I have a question about DevExtreme Grid’s events in Edit mode.
                                    In our program we need to perform some logic actions on server side if the current selected row is changed, and the data of previous selected row was changed also, i.e. when the current selected row is changed, I need to process the modified data of a previous selected row on the server side. For this purpose, I defined a handler function (onFocusedRowChanged) on FocusedRowChanged event and the handler function (onUpdated) on Updated event.
                                    onUpdated function saves the modified data of the current selected row in my custom object on Client side.
                                    onFocusedRowChanged function should send the data to server side when the current selected row is changed.
                                    The problem is that the FocusedRowChanged event is raised before Updated event, so the changes are not saved in my custom object and as result are not sent to server side.
                                    For example, see
                                    In the example:

                                    1.  changing the value in FirstName field of the first row the following message is written to the console:“Update event raised: Changed field FirstName, Row key 1”.

                                    2. Changing the selected row from first to second the following message is written to the console:
                                    “FocusedRowChanged event raised: Row index 1”

                                    The Example shows that the FocusedRowChanged event raised twice (before and after Update event raised).

                                    My question is why the FocusedRowChanged event raised before Update event and / or what event you recommend me to use to achieve my purpose?

                                Show all comments
                                • Lex (DevExpress Support) 01.14.2020

                                  Hi Hezkia,

                                  I reproduced the issue and forwarded this ticket to our team for further research. We will inform you once we have any news.

                                  For now, I recommend you try the onOptionChanged event handler for your scenario. This event is raised only once when you change the focused row.

                                • HEZKIA MOFAZ 01.15.2020

                                  Hello Lex,
                                  Thanks for your answer.

                                  I tried the onOptionChanged  event handler, but this event is not helpful for my scenario also.

                                  For my task I need that at the moment that the focused row is changed, the data of a previous focused line was already updated, i.e. the Update event was raised before the FocusedRowChanged  event.

                                  I process the changes of the previous focused row on server side when the focused row is changed, therefore if the Update event is raised after the FocusedRowChanged  event, I never will get the changes of the previous focused line on the server side.

                                • Lex (DevExpress Support) 01.15.2020

                                  Thank you for the update, Hezkia. We will take your scenario into account and inform you of our results.

                                • HEZKIA MOFAZ 01.23.2020

                                  Hello Lex,

                                  Is this ticket in process and what is ETA?
                                  It's very urgent to us.


                                • Lex (DevExpress Support) 01.23.2020

                                  Hi Hezkia,

                                  We have some updates for you. First of all, I'd like to note that we considered that our grid should not raise the focusedRowChanged event twice, so we are going to fix this issue. We will inform you once we have any news.

                                  So, after this change, the sequence of events should be the following:

                                  As you can see, the focused event is raised before the update event. It occurs because the update is triggered by changing a focused cell/row in the grid.

                                  So, in your scenario, we recommend using the following approach to resolve the issue:

                                  1. Handle the onFocusedRowChanging event instead of onFocusedRowChanged to conditionally save row data.
                                  2. Use the following condition to determine when you need to save grid data and perform required changes in your code:
                                  function onFocusedRowChanging(e) { var hasChanges = e.component.hasEditData(); if(hasChanges && e.prevRowIndex!== e.newRowIndex) { var pr = e.component.saveEditData();//use the returned promise to perform additional actions after the row/cell is saved. } },

                                  The saveEditData method returns a promise, so once the promise is resolved, you can use it to perform additional actions in the grid. This approach should work after the fix as well. Please try it and let me know your results.

                                • HEZKIA MOFAZ 01.23.2020

                                  I understand, but would like to suggest my opinion:

                                  in regards to what you wrote:

                                  "As you can see, the focused event is raised before the update event. It occurs because the update is triggered by changing a focused cell/row in the grid."

                                  wouldn't it make more sense to use this order of events: (where focusedRowChanging triggered rowUpdating)


                                  as a user, I expect that when a "focusedRowChanged" event fires, the grid is already up to date... as the name implies it happened (unlike focusedRowChanging)

                                  or you could give another API like


                                • Lex (DevExpress Support) 01.24.2020

                                  Hi Hezkia,

                                  Thank you for the update. We discussed your suggestion with our team and agree that the behavior you described is more suitable for this scenario. Since the focusedRowChanged event worked in the way I described for a long time, we need to perform some additional research to see if it's possible to change the existing behavior in the future. We will let you know about our results once we have any.

                                  In the meantime, you can use the following workaround for your scenario:

                                  var newRowIndex; function onContentReady(e) { if(newRowIndex !== undefined) { e.component.option("focusedRowIndex", newRowIndex); newRowIndex = undefined; } }, function onFocusedRowChanging(e) { if(e.component.hasEditData()) { e.cancel = true; newRowIndex = e.newRowIndex } }, function onFocusedRowChanged(e) { if(newRowIndex === undefined || newRowIndex === e.rowIndex) { console.log("onFocusedRowChanged", e); } },

                                  This way, you will be able to continue using the focusedRowChanged event as you did before.

                                  Let me know if it helps.

                                0 Solutions

                                Creation Date Importance Sort by