0

I'm using the w2grid widget on inline editing mode.

My program needs save changes to database each time the user introduces a new value into the cell grid.

To do this, I defined a onChange event to the grid, and when onChange is triggered the save() method is called:

onChange: function(event) {
    w2ui[event.target].save();
}

The problem is that the save() method sends old data values to the server (It doesn't send the last update). At the first modification getChanges() array is empty. And the next onChange event will not send the last modification, but the previous modified values.

What I'm doing wrong?

Jesús
  • 21
  • 4

1 Answers1

0

I found what I'm doing wrong.

The documentation says about the events:

"By default all event handlers are triggered before the default behavior is processed."

"You can also define a function that will be executed after the default behavior is processed."

So, for waiting until the event change is completed:

function (target, event) {
    event.onComplete = function () {
        w2ui[event.target].save();
    }
}
Jesús
  • 21
  • 4