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
60
Get row id of igx grid
posted

Hello,

I have a igx grid with editable rows. When cells from a row are edited I want to update my SQL database with the new values. Is there a row Id or something like that, so that I know which rows are edited?

  • 640
    Verified Answer
    Offline posted

    Hello Silvia,

    Thank you for posting in our community.

    You can use rowEditDone or cellEditDone events of IgxGrid which return the rowID of the edited record.

    I have created a small sample demonstrating how to edit remote records using cellEditDone event:

    HTML

    <igx-grid #grid [data]="data" primaryKey="objectId" (cellEditDone)="cellEditDoneHandler($event)">
       …
    </igx-grid>
    

    TYPESCRIPT

     public cellEditDoneHandler(args: IGridEditDoneEventArgs) {
            const fieldName = args.column.field;
            this.http.put(`${this.url2}/${args.rowID}`, { [fieldName]: args.newValue })
     }

    Please test the sample on your side and let me know whether you find it helpful.

    Additionally, you can also use the Batch Editing feature of the IgxGrid for editing of remote data. More information about it can be found here.

    Please let me know if you have any further questions and concerns.

    Regards,
    Viktor Kombov
    Entry Level Software Developer
    Infragistics, Inc.