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
355
igGrid CRUD operations
posted

I want to perform CRUD operations in the grid. I want to do individual updates and do not want to commit the grid on client side until the CRUD operations have taken place in the database successfully. So when deleting a row in the grid

 

$('body').on('iggridupdatingrowdeleted', '#grid', function () {

  $('#grid').igGrid("saveChanges")

 if (SuccessfulUpdate)

{

 $('#grid').igGrid("commit");

}

else

{

// Do not commit

}

});

How can I check for successful DB update here?

Parents Reply Children
  • 17590
    Offline posted in reply to Anonymous

    Hello,

    Thank you for getting back to me.

    I created a small sample illustrating your scenario and I am attaching it for your reference. In my sample I have an igGrid with remote data source set via dataSourceUrl property the and Updating feature enabled. I am editing a row and I am calling saveChanges method by clicking Save Changes button. I set the success in the response to false in order to hit the error callback of the saveChanges method. In this handler I am calling dataBind and on my side the grid is successfully bound to its initial data source. For example:

     <script>
            $(function () {
                $("#btn").click(function () {
                    $("#grid1").igGrid("saveChanges", function (data) {
                        alert("Changes were saved successfully")
                    },
                    function (jqXHR, textStatus, errorThrown) {
                        alert("An error occurred while saving the changes. Error details: " + textStatus);
                        $("#grid1").igGrid("dataBind");
                    });
                });
            });
        </script>

    Could you please test this sample on your side and let me know what is the result. Additionally, if this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me for further investigation along with steps to reproduce.

    igGridSuccessFailedCallback.zip