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?