Background: I need the user to submit data a row at a time, so I cannot use autoCommit.After I edit a row, but before committing the changes, if I then change a filter the grid throws this error:Grid has pending transactions which may affect rendering of data. To prevent exception, application may enable "autoCommit" option of igGrid, or it should process "dataDirty" event of igGridUpdating and return false. While processing that event, application also may do "commit()" data in igGrid.The grid unfortunately shows the spinning "busy" icon so its clear to the user that something is wrong.I'd appreciate suggestions. Turning on autoCommit isn't an option as I said before. If dataDirty returned false the user would lose their edits.
It does seem like the grid could in theory support sorting and filtering while preserving pending changes, but I'm guessing that would be a big change. (FYI: both Sorting and Filtering are set to type "local".) A fallback might be for us or the grid to do one of the following:
a) Disable filtering and sorting until changes are committed or rolled back.
b) Detect the problem, ask the user whether its okay to revert their changes. If they say no, then keep their changes and ignore the filter/sort operation.
FYI I don't think (b) is currently possible-- I tried using dataDirty for something similar and found that it simply wasn't designed to allow a clean interruption of a data refresh. (Discussed here: http://www.infragistics.com/community/forums/p/97749/482119.aspx#482119)
Worse comes to worse we could redesign our screens, for example add new rows using another screen instead of inline in the grid. We'd rather not though.
Thanks,
Matt
Hello Mathew,For option a) you can handle columnSorting or dataFiltering and cancel them if there are pending transactions.Here is an example code:{ name: "Sorting", columnSorting: function (evt, ui) { if (ui.owner.grid.pendingTransactions().length > 0) { alert("You first need to commit or rollback your changes"); return false; } }}
I will research whether scenario b) is achievable and will write back.
Best regards,Martin PavlovInfragistics, Inc.
Thanks! This worked nicely. Alerting the user and preventing the error will be good enough for this particular application.
(in addition to checking pendingTransactions().length I also check isEditing, to detect if the user hasn't finished editing the row yet.)
I am interested if you find anything for scenario (b) but it is not a requirement for this application.
Thanks!
Hello Matthew,
Unfortunately option b) cannot be implemented using the dataDirty event. At the point when dataDirty is called there is no good way to ignore sorting/filtering operations. You just can commit/rollback user changes.
Not unexpected-- thanks for double-checking.
Unless & until the grid supports filtering/sorting with pending transactions, the workarounds we discussed above work perfectly. Thanks for the help.