Forum Stats

  • 3,768,187 Users
  • 2,252,756 Discussions


Error raised Cannot read property 'toString' of undefined in Interactive Grid

Roxy rollers
Roxy rollers Member Posts: 69 Red Ribbon

I have an Interactive Grid in Edit mode and the Error raised is coming from the PopupLOV. I do have a Dynamic Action on the field that has the PopupLOV.

Option #1. When you click on LOV for Column "Address Type", it displays the Popup LOV nicely and you can go and select a value from LOV and all works well.

Option #2. When you enter some incorrect value in "Address Type" (YYY), then what I am doing is automatically showing the LOV (With all valid Sources displayed). If I now select a proper source "UNKNOWN" from LOV, I am getting an Error "Cannot read property 'toString' of undefined.

I am wondering if the Current RowId is the issue (The Error also says "at Object._getRecordById"). The error is occurring in the line below for Option #2.

var rowId = $te.closest('tr').data('id');

Dynamic Action:

Code When True is:

var $te = $(this.triggeringElement);var rowId = $te.closest('tr').data('id');console.log("TE / RowID", $te,rowId);var add_type = apex.item( this.triggeringElement ).getValue().toUpperCase();var model = apex.region("ig_address").widget().interactiveGrid("getViews", "grid").model;var record = model.getRecord(rowId);var grid = apex.region("ig_address").call("getViews","grid");var actRec = grid.getActiveRecordId();apex.server.process (     "get_source_type",      {x01: add_type},      {      type: "POST",      async: false,      dataType: 'text',      success: function(pData) {      if (pData.substr(0,1) === '0') {          console.log('pData = ',pData);          model.setValue(record,"ADD_TYPE",'');          $('#add-type_lov_btn').click();      }      else if (pData.substr(0,3) === 'ERR') {apex.message.alert('Unexpected error. Please contact your Database Administrator.');}        else {        console.log("Passing Actual Data");          // model.setValue(record,"ADD_TYPE",pData);        }      },      error: function(jqXHR, textStatus, errorThrown) {         apex.debug("*** An error occurred. ***");         apex.debug("textStatus: " + textStatus);         apex.debug("errorThrown: " + errorThrown);}          });

Any pointers for this issue would be great. Thanks and Happy Monday.