mercredi 2 mars 2016

How to commit changes in a cell from code in slickgrid

I have used custom formatter and editor in slickgrid, which is simply checkbox angular directive. I am using twice the directive, once for formatter, and once for editor. Formatter and Editors are served from angular service. Slickgrid itself is wrapped into an angular directive.

Editors are implemented according to slickgrid doc Writing custom editors

The slickgrid directive is used in several places. One scenario, which I am struggling with, is when there is a grid, and there are buttons outside of grid.

When one clicks one of this button, I have to get the values from cells/editors.

When grid is rendered, once sees checkbox. it is checked/unchecked based on current value of a cell where this formatter is used.

And when one clicked on a cell with checkbox, the checkbox changes from unchecked to checked or vice versa. And then one clickes somewhere else in the grid in the value of editor checkbox copied to cell, and then formatter shows checked/unchecked.

Back to my scenario: when one checkes/unchecks checkbox in editor mode, and directly clickes one of the buttons outside grid, the value of editor is not applied yet to cell, thus the wrong value is send. While we are still in editor mode, and value is not committed.

Now the question, how to commit changes to cell right after the value of checkbox is changed dynamically without waiting for slickgrid to change from editor mode to formatter mode?

Found this question relative, but my environment is the same.

I found that editor takes args argument which has commitChanges() method, but how to use it?

Best




Aucun commentaire:

Enregistrer un commentaire