Hi, I am trying to use an igGrid that is updated in real time by API (not from user actions), with a local (initially empty) datasource in a Single Page Application.
Modifying the datasource does not trigger a grid redraw.
Modifying the grid with igGridUpdating.addRow works, but the new row does not respect filtering/sorting/grouping, it's added at the end of the grid without any rules applied...
Rebinding the whole datasource works but
All those problems with rebinding are logical, but that is because rebinding is not designed for partial redraw but for loading a whole new datasource.
Hello josselin Pujo,
Thank you for posting on our forums.
You should be able to maintain sorting by first committing the added row to the underlying DataSource (JSON), and calling the sortMultiple method as demonstrated in the attached sample.
To learn more, please review the API for igSorting: https://www.igniteui.com/help/api/2014.1/ui.iggridsorting
sortMultiple .igGridSorting( "sortMultiple" );Sorts grid columns and updates the UI.Code Sample$(".selector").igGridSorting("sortMultiple");Please review the sample and let me know if you have any questions.
I ran into the same issue. The way we resolved it was to navigate to the current page. I see you didn't mention paging at all so I don't know if you have option enabled or not. If so, you can just do this:
// 1-liner$("#.selector").igGridPaging("pageIndex", $("#.selector").igGridPaging("option", "currentPageIndex"));
// Clearervar pageIndex = $("#.selector").igGridPaging("option", "currentPageIndex");$("#.selector").igGridPaging("pageIndex", pageIndex);
This will force a redraw of the current grid but for a single page. Not the entire data source. By default, the number of records on the page is capped at 100 and will preserve your filtering, sorting and grouping.