Hi Everybody. I have a grid and want to update/manipulate some of its elements

Hi Everybody. I have a grid and want to update/manipulate some of its elements as changes are made by the user to other elements. We use the Advanced Forms Utilities plugin and JS code on grid elements "change" Event Rules for that purpose. For example this code for adding the "num1" and "num2" columns and placing it in "num3" :

var index = window.FormDesigner.lastRowEvent;
var aRows = window.FormAPI.getValue("num1").id.split(';');
var bRows = window.FormAPI.getValue("num2").id.split(';');
var a = aRows[index];
var b = bRows[index];
var c = parseFloat(a)+parseFloat(b);
if ( !isNaN(c) )
{
document.getElementsByName("num3")[index].value=c;
}

This works so long as the user is just adding rows or modifying elements, but when a row is deleted then the "lastRowEvent" references are incorrect and the wrong elements are used as the user makes changes.

How can I reference the row index and elements correctly in all circustamces as the...

OriginalPostID-42448

OriginalPostID-42448

  Discussion posts and replies are publicly visible

  • ... user makes changes?

    This was pointed out previously in the forum, however I can't find or understand the resolution for it. Hints and pointers are appreciated. Thanks.

  • @hajii - i had a similar problem .. but my logic was to loop through all the elements in the field list so i din care about the row index ..
    i tried to call the same manipulation logic from two places .. one from that particular cell "onChange" (which works perfectly when we keep on adding rows) and other when a "Delete row" event takes place (this is for the issue). For the second i placed the below code in form "onLoad":
    $(".deleteRowIcon").click(function(){
    alert("A row has been deleted");
    //Logic goes here\t
    });
    Although the alert came up, i got a new issue. All rows got deleted instead of the one i tried to delete.
    Hope u can explore from this and get some solution.