3

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.

Konstantin Dinev
  • 34,219
  • 14
  • 75
  • 100
Dixit Gokhale
  • 601
  • 1
  • 12
  • 32

1 Answers1

5

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?

Damyan Petev
  • 1,585
  • 7
  • 10
  • How does filtering help with updating partial data on a grid? – monkeyjumps Oct 22 '16 at 20:43
  • @monkeyjumps The original question only had this as context - MVC + a call to query part of the data, no idea whether the data on the client was partial, but it might as well be. My point was, if the goal was to filter the data and show it, you might as well take advantage of the feature the grid already has.If the data is paginated - that much better, the server side `[GridDataSourceAction]` attribute can handle both remote Paging and Filtering out of the box like here: http://www.igniteui.com/grid/aspnet-mvc-helper – Damyan Petev Nov 03 '16 at 14:16