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
220
Reload igx grid when data is changed
posted

 Hello, I have an igx grid inside a dialog. I use the array posts as data for the grid. The values of this array may be changed through the program. How can I update the grid data with the last value that I have for the array posts?

<igx-dialog #dialog>
  <igx-grid #grid1
            [emptyGridMessage]="'The grid is empty'"
            width="1200px"
            [data]="posts"
            height="600px"
            style="margin: auto"
            [primaryKey]="'person'">
    <igx-column field="person" dataType="string" header="PersonId"></igx-column>
    <igx-column field="name" dataType="string" header="Name"></igx-column>
  </igx-grid>
</igx-dialog>

P.S. I am using C#.

I tried this.grid1.refreshGridState() but it does not work.

Parents
No Data
Reply
  • 2680
    Offline posted

    Hello Silvia,

    Thank you for posting to Infragistics Community.

    I have been looking into your question and created this small sample with an IgxGridComponent, where the bound data is updated every 1,5 seconds. The grid is also placed within an IgxDialog, as I can see it is from your code-snippet.

    What I can say is that generally the grid will reflect the modifications when change detection is run. In the sample, everything works as expected and the data updates are timely reflected by the grid when calling the refreshGridState() or by simply reassigning the bound data array: this.localData = [...this.localData];.

    Currently, it is hard to tell what may cause this behavior on your side and I would suggest making sure that the updates are correctly coming through and are reflected by the bound ‘posts’ array. However, please, keep in mind that the details about your server-side data related logic would be out of the scope of Infragistics support. Please, test the linked sample on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce.

    Sincerely,
    Bozhidara Pachilova
    Associate Software Developer

Children
No Data