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
590
Remove the entire row on delete (Not crossed out row)
posted

I have autoCommit set to false, & I cannot set it to true because it will mess up other working code in my application.

I want to delete the entire row (Remove from grid) & dont want a crossed out row in the grid awaiting a commit.

Also , calling DataBind() immediately after deleting it is not an option because the rows are still in transaction log & will get committed to the server onnly when the user click the submit button which will post the entire form. I am not using saveChanges() method of igGrid for committing the row because of some shortcoming of this method. I manually commit all the igTransactions as a batch.

  • 16310
    Offline posted

    Hello Allana,

    I suggest that you handle the "rowDeleted" event to call "dataBind" method and also handle the "dataDirty" event to call "commit" method.

    How this works:

    Calling "dataBind" when there are pending transactions as in your case may affect rendering of data. In this situation you should process "dataDirty" event (it will be fired after you call "dataBind" in "rowDeleted" event) of igGridUpdating and do "commit" in igGrid. If you do not want to send all other transactions since you are manually handling them you can specify the rowId in the commit method so that only the transaction corresponding to this row will be commited:

    features: [
        {
            name: 'Updating',
            rowDeleted: function (evt, ui) {

                rowId = ui.rowID;
                $("#grid").igGrid("dataBind"); // will fire the dataDirty event
            },
            dataDirty: function (evt, ui) {
                $("#grid").igGrid("commit", rowId); // commits only the transaction corresponding to the deleted row
            }
        }
    ]

    I am attaching a sample that demonstrates how this works.

    igGrid_rowDeleting.zip