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
40
Refresh data in igGrid after sql data update at the backend
posted

Hi,

I have an igGrid which gets loaded with data from a sql table. I have a button which does an ajax call to a controller method which inturn runs some processes and ends up making updates to the data at the backend. I'm trying to refresh the grid data on the success of thart ajax call. I'm using $("<gridID>").igGrid("dataBind") in the success section,but, I don't see anything happening. Does dataBind automatically makes a call to sql backend to get data and then bind it? Or will I have to get the updated data manually and then bind it to the grid.

Regards,

Guru

Parents
No Data
Reply
  • 485
    Offline posted

    Hello Guru,

     

    Thank you for posting in our forum.

    The igGrid’s “dataBind” method rebinds the igGrid to the local or remote data source and re-renders it, but it doesn’t make any changes to your SQL backend.

    In case you are using a local data source, what you could do is the following:

    • Make a GET request to the server to get the new data
    • In the success callback you pass it as an option of the grid
    • The grid would re-render itself, so actually there is no need to call dataBind().

    Your code may look something like this: $.ajax({

                   url: 'theUrlToYourBackend',

                   data: {

                       format: 'json'

                   },

                  success: function (data) {

                       $("#grid").igGrid("option", "dataSource", data);

                   },

                   type: 'GET'

               });

     

    If you need any additional assistance, feel free to contact me.

     

     

    Best Regards,

    Vasil Pavlov

    Associate Software Developer

    Infragistics, Inc.

Children