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
65
Javascript function jumps in wrong place
posted

function js_AfterUpdate(grid, cell)
{
var grid = igtbl_getGridById(grid);
var cell = igtbl_getCellById(cell);
var aRow = cell.getRow();
aRow = aRow.getNextRow(true);
var aCell = aRow.getCell(0);
aCell.activate();
}

Can i some how get index by column id for function getCell(0)?

 

  • 65
    posted

    Got it after few hours. 

    //Change to next row and update value 

              function js_AfterUpdate(grid, cell)
                    {  
                    var grid = igtbl_getGridById(grid);  
                    var cell = igtbl_getCellById(cell);  
                    var aRow = cell.getRow();  

    //Update value
                    if(cell.getValue()!=0 && cell.getValue()){  
    //problems with ','
                       var val1 = aRow.getCell((cell.Index)-2).getValue().replace(',','.');
    //problems with ','
                       if(val1==0)val1 = aRow.getCell((cell.Index)-1).getValue().replace(',','.');
    //Add new value
                       aRow.getCell(cell.Index+1).setValue(val1/cell.getValue());}
            
                    aRow = aRow.getNextRow(true); 
    //cursor moves one to te left so right index is current index - 1                
                    var aCell = aRow.getCell(cell.Index-1);  
                    if(aCell)aCell.activate();  
                    }

     

    ps. how can you delete your own post?