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
215
Get current updating rowId from editorOptions event
posted

How can I get the current datarow or row Id of the actively updating row from an event of the editor provider for the cell


features: [
{
 name: "Updating",
 editMode: "cell",
 showDoneCancelButtons: false,
 columnSettings: [
  columnKey: "myCol",
  editorType: "mask",
  editorOptions: {
   inputMask: 'aaa',
   keyup: function (evt, ui) {
    alert("I want to access the current editing row here!");
   }
  }
 ]
}
]

  • 5513
    Offline posted

    Hello,

    Each row element in the grid contain an attribute holding its associated PK value. As each editor is a descendant of the row in the DOM tree the most straightforward way to extract this information is through a call like this:

    keyup: function (evt, ui) {

        var pk = ui.owner.element.closest("tr").attr("data-id");

    }

    This will return it as a string that you should pass through parseInt in the case of a numeric PK or replace attr("data-id") with data("id").

    If the result is undefined you will know that the end-user is trying to add a new row instead of editing one.

    I hope this helps! Please, let me know if you have any other questions or concerns!

    Thank you for using Infragistics forums!

    Best regards,

    Stamen Stoychev