Skip to content

Infragistics Community Forum / Web / Ignite UI for jQuery / How to get row values on edit row started event?

How to get row values on edit row started event?

New Discussion
Pete Cougan
Pete Cougan asked on May 31, 2019 6:17 AM

I have an igGrid that allows row updating. I need to be able to call a method and get the current row values when the user starts to edit to the row, yet for some reason the ‘editRowStarted’ event does not return a reference to the values of the row. ‘editRowEnded’ is a good example of what I want – it allows you to access the values of a row simply by calling ‘ui.values’ on the ui parameter of the function. I know that ‘editRowStarted’ does return the ‘rowID’, but I have not been able to use that to get the values from a row. I’m sure this is a simple fix that I am overlooking.

Sign In to post a reply

Replies

  • 0
    Pete Cougan
    Pete Cougan answered on May 29, 2019 4:05 PM

    I was able to get the values, but the way it was done is not preferred. I don't want to have to pick apart my document to get the values I need. There should be (and probably is) a way to return a JSON object, or at least some sort of structured data.

    var row = $('.selector').igGrid('rowById', ui.rowID)[0];
    var dataID = row.getAttribute('data-id');
    var cellValue = $('.selector_table tr[data-id="'+dataID+'"] td[aria-describedby="selector_table_ColumnTitle"]').text();

    P.s. the code editor on here is awful. The cursor does not insert or delete characters at the position clicked and shown….

    • 0
      Vasya Kacheshmarova
      Vasya Kacheshmarova answered on May 31, 2019 6:17 AM

      Hello Pete,

      Thank you posting in our community.

      Your observation is correct, at this point cell values are not available via the arguments of editRowStarted event. However, I can suggest a few options for achieving your requirement.
      Using getCellvalue method,which retrieves the value by its rowID and columnKey. Since this method works cell by cell in order to get all cell values you will have to loop all the columns (or just the one needed for your scenario). For example:
                editRowStarted: function(evt, ui){
                         var grid =  $("#grid"), colKey;
                                gridCols = grid.igGrid("option", "columns");
                        $.each(gridCols, function(index, val){
                        alert("Value of column " + gridCols[index].headerText + " is: " + grid.igGrid("getCellValue", ui.rowID,gridCols                       [index].key ) );
             });
            },
      This code will loop trough all column in the columns collection and will show their values in an alert box.
      Using editCellStarted event. This event is fired after cell editing begins and before editRowStared event is fired. Basically, the event is going to be fired once for every cell in the row. In this event, via the ui event argument the cell value is available. For example:
                 editCellStarted: function(evt, ui){
                         var cellValue = ui.vakue
                 }
      Please let me know if you need any further assistance with this matter.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Pete Cougan
Favorites
0
Replies
2
Created On
May 31, 2019
Last Post
6 years, 9 months ago

Suggested Discussions

Created by

Created on

May 31, 2019 6:17 AM

Last activity on

Feb 12, 2026 7:40 PM