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
825
Handle dataDirty without generating an uncaught exception
posted

I have a function to warn the user if the grid didn't refresh due to unsaved changes:

        {
            name : 'Updating',
            dataDirty: function(evt, ui) {
                // warn the user
                show_warning("You have unsaved changes. The invoices will be refreshed after you Save or Revert your changes.");
                return true;
            },

For example, if the user edits a search criteria on the page that would normally refetch the rows. They instead get a warning. The dataDirty function returns true so that the grid ignores the new data being bound to it.

This works, but the console displays an uncaught exception:

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.

I do want to interrupt the grid from loading the new data, but without a messy message appearing in the console. Is there a way to catch or suppress this error? Or is there a better way to handle dirty data in general? Thanks.

Parents
No Data
Reply
  • 15320
    Verified Answer
    Offline posted

    Hi Matthew,

    I believe that this exception tells clearly what should be done to prevent it. You have 3 options:

    - enable 'autoCommit' option of the grid

    - process 'dataDirty' event and return false

    - process 'dataDirty' event and call ui.owner.grid.dataSource.commit()

    If you have any further questions, please let me know.

    Regards,

    Tsanna

Children