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
88
Setting value of a cell raises javascript error
posted

Maybe it is wiser to make a new thread out of this. I posted this as a response to another thread that is already marked as solved:

http://blogs.infragistics.com/forums/t/53319.aspx

 

It is about that I am trying to set a cell's value via javascript, but I get a JScript error message stating that there is not enough stack memory. After my call to cell.set_value(...).

This is what I do:



function WebDataGrid1_Editing_CellValueChanged(sender, eventArgs) {

    var grid = $find("<%= WebDataGrid1.ClientID %>");
    var row = eventArgs._cell._row;

    var value1 = 0;
    var value2 = 0;

    for (var j = 0; j < row.get_cellCount(); j++) {
      var cell = row.get_cell(j);
      var value = String(cell.get_value()).toLowerCase();

      if (cell._column._key == "Value1")
        { value1 = parseInt(value); }

      else if (cell._column._key == "Value2")
        { value2 = parseInt(value); }

      else if (cell._column._key == "Result") {
        if (!isNaN(value1) && !isNaN(value2)) {
          var result = value1 + value2;
          cell.set_value(String(result));
        }
        else { cell.get_element().innerHTML = "n/A"; }
      }
    }
}



The debugger stops on a line in some auto-generated javascript file:

return function() {
return method.apply(instance, arguments); //crash here
}

Any idea?



Edit: Working with NetAdvantage 10.3, IE 8

Parents
No Data
Reply
  • 3115
    Offline posted

    Hi HoKaGmbH,

    On which event do you use that function?

    Because I've used your code and I hook on "ExitedEditMode", which is one of CellEditingClientEvents, and the code works fine and the value in the cell is changed, I've just changed the "Result" to "ProductName", as that's how one of my columns is named

     

    Thanks,

Children