Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
675
How to handle pre-save validation
posted

Using IG 12.2, IgniteUI.igGrid...

I have a grid configured to row edit mode and batch updating.  I have turned off the Done and Cancel buttons.

I like the fact that a row's text turns to italics after the user edits a row.

When the user clicks a button to save the edits, I need to do some validation on the entered values before allowing the save.  I'm trying to do this in Javascript by reading values from the grid's datasource

var grid = $('#myGrid');

var ds = grid.data("igGrid").datasource.dataView()

But I find that the datasource doesn't have the values unless I call commit on the grid.  This commit call clears the italics from the text.

When I finish my validation code, if the rules fail, I don't save the edits, but I would like to have the edited row still show italics.  I have tried calling rollback on the grid to no effect.

Is there a better way to get the edited data without commiting on the grid?

Is there a way to reinstate the italics in the case where I don't call savechanges?

Thanks in advance for any suggestions.

 

  • 1800
    posted

    Hi,

    So you have disabled autoCommit. So you can get in the igGrid methods - pendingTransactions - which returns all transaction objects and you can apply validation on them - please go to http://help.infragistics.com/jQuery/2013.1/ui.iggrid and then click on tab "Methods". You can get all pending transactions and then to commit ONLY those of them that you have verified using commit method(again please refer to the same help resource).

     

    Thanks,

    Miro

  • 675
    posted

    The other part of this is how to handle the situation where the user has not ended the edit session.  For example, double-click in a cell to enter edit mode, type some changes and then hit the Save button without tabbing out of the edited cell.

    In this case, even calling commit does not get the user's edit into the datasource.

    I thought that calling grid.igGridUpdating("endEdit", true) should handle this case but it seems to have no effect on the grid.