I want to implement a method that cancels moving to the next row if data has changed. My thought was to use the on-current-change event as this provides me with the oldCurrentRow. What event should I emit with what parameters to achieve staying on the last highlighted row.
You can find a fiddle here https://jsfiddle.net/arjanno/pdazb5kf/28/
Key is what happens here
onCancel: function () {
//Move back to oldCurrentRow
this.$Message.info(`Clicked cancel`);
}
As long as you don't set data dirty you should be able to click on any row. When you click Dirty it should show a modal asking you if you want to lose your changes. On cancel I want to stay on the row I was before clicking on another row.
I don't think we can know the
indexof the row by the data theon-current-changecallback gives us. This can/should be changed since its useful, fell free to open a issue for it.In any case what you can do is to compare the last selected row with the current data set and use the
_highlightkey to telli-tablewhich row to highlight.Example: https://jsfiddle.net/pdazb5kf/40/
The code would be: