Dixit Gokhale
Dixit Gokhale

Reputation: 671

How to re-bind the data in the igGrid igniteUI control on click of a button?

I am using Infragistics(Ignite UI) controls in my ASP.NET MVC3 application. I have grid which I've bound to 'Customer' data. Works fine. Now I have button. On clicking I make an ajax call. In the controller I write query which selects only a part of 'Customer' data. I return the data using json. I try to re-bind it using:

$("#CustomerGrid").igGrid("dataSourceObject", returnData);    

But the grid continues to show old data. It doesn't refresh.

Upvotes: 4

Views: 7581

Answers (1)

Damyan Petev
Damyan Petev

Reputation: 1635

Call the data bind method like so:

$("#CustomerGrid").igGrid("dataSourceObject", returnData);
$("#CustomerGrid").igGrid("dataBind");

or even like so:

$("#CustomerGrid").igGrid("dataSourceObject", returnData).igGrid("dataBind");

Just a general note - changing the data source can be extra overhead and generally not ideal solution. If I understand correctly you are replacing it with a part of the original collection? If the collection is big and/or you need to reset back to original state - perhaps consider simply returning id-s to the ajax call and use the Filtering feature?

Upvotes: 6

Related Questions