H20rider
H20rider

Reputation: 2282

SlickGrid: Invoke onCellChange

I am currently using SlickGrid in my app. The problem that I am having is invoking the onCellChange when I click a button. When I click on a cell, enter a value and move to another cell it will invoke the onCellChange event.

But when I click on a cell and then click on a button on the page, I need the OnCellChange event to fire. Any way of accomplishing this?

What we are currently doing is when a value has changed in the cell, we save that as a shadow value to the server. And then a person can commit those shadow values. The problem that I have is you can change a cell value then hit a commit button. At this point the OnCellChange doesnt fire, so that shadow value for that cell has not been saved to the server.

Personally I don't agree with the way we are doing it, but that is out of my control

Thanks. John

Upvotes: 1

Views: 2050

Answers (3)

Danish
Danish

Reputation: 503

Just call this line on button click.

args.commitChanges();

This will fire onChange event of SlickGrid

Upvotes: 1

Jatin patil
Jatin patil

Reputation: 4298

Just call these lines on button click, it will fire the onCellChange event if there will be any active cell. Its working for me.

    if (grid.getActiveCell()) {
        var row = grid.getActiveCell().row;
        var cell = grid.getActiveCell().cell;
        grid.gotoCell(row, cell, false);
    }

Upvotes: 2

H20rider
H20rider

Reputation: 2282

I was able to solve my issue by calling the following method.

Slick.GlobalEditorLock.commitCurrentEdit();

Upvotes: 1

Related Questions