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
335
igGrid Live updates
posted

Hi !

I'm trying to implement live data on the client side with igGrid + igDataSource. I have html page and wcf rest service, i'am using   setInterval method to request items from service.

 setInterval(function () {
                $.ajax({
                    type: "GET",
                    async: true,
                    url: 'Service1/Orders',
                    dataType: "json",
                    success: function (result) {
                        $(result).each(function (key, value) {

                           gridrowIndex++;
                           gridDataSource.addRow(gridrowIndex, value, true);
                        });
                    
                      gridDataSource.commit();
                    },
                    error: function (xhr) {
                        alert(xhr.responseText);
                    }
                });
            }, 5000);

All rows are coming to datasource, but there is no updates in my igGrid until i apply sort, group by, move to the next page by mouse click.

 

DataSource init:

var gridData = [];
var gridrowIndex = -1;
var gridDataSource = new $.ig.DataSource({
             dataSource: gridData,
              type: "json",
              filtering: { type: "local" },
              sorting: { type: "local" },
              paging: { enabled: true, pageSize: 10, type: "local" }
        });

igGrid init:

$("#grid1").igGrid({
              virtualization: false,
                autoGenerateColumns: true,
                autoCommit: true,
                dataSource: gridDataSource,
                height: '930px',
                width: '700px',

.....

});

 

 

I tried to play around commit(), savechanges() etc on igGrid and igDatasouce but it doesn't help.

 

What's wrong? any ideas?

Parents Reply Children
No Data