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
585
Get primary key value for row deletion
posted

I have a delete function that calls .igGridUpdating("deleteRow", rowId, tr) for row deletion. How can I get the actual primary key value (rowId) of the row? Passing the selected row index does not work in the server side.

I was trying to get the rowId from the rowDeleting(evt, ui) event but the event wasn't fired in my scenario:

1) select a row

2) click a Delete button to call the delete function.

As long as I can get the rowId for deleteRow(), either triggering from an event or making a function call would work for me. 

Thanks!

  • 23953
    Verified Answer
    Offline posted

     

    Hi Erica,

    First you should declare igGrid.primaryKey option. This ensures that each table TR element will have data-id attribute containing the value of the PK.

    When you call igGridSelection.selectedRows methods you'll get the selected TR's. From them you can extract the data-id attribute value and pass it to the igGridUpdating.deleteRow method.

    I've attached a sample which demonstrates this.

     

    Best regards,

    Martin Pavlov

    Infragistics, Inc.

    igGridSelection_deleteRow.zip