3.2.0

disData[0][0]

Hi Alex,

var firstSeqNum = disData[0][0];

If I intend to set a seqnumber based on the above statement, when the grid is building and this field is not populated it throws an JS error disData[0] has no properties.
How can I handle disData[0][0] having no value without throwing this error??
i.e if firstSeqNum has a value do something otherwise alert('no seqnum set');

Appreciate any help
Tony again
June 23,
Tony, what is seqnumber? Can you post (send me) the code?
Alex (ActiveWidgets)
June 24,
Hi, take this example.
I have a populated grid (mygrid) and if I dont select any row on the grid and hit a button to call this function below it throws an error on custNum = disData[myGrid.getProperty("selection/index")][2] line giving the following javascript error
disData[myGrid.getProperty("selection/index")] has no properties.

In this scenario I would like to display an alert saying you've no customer selected but it wont execute past the statement in error


function switchCustomer( disData )
{
var custNum = "";
custNum = disData[myGrid.getProperty("selection/index")][2];
if (custNum == " "){
alert('You have not selected a customer');
}
else{
alert('You have selected a customer');
}
}
Tony
June 25,

function switchCustomer( disData )
{
  var custRecord = disData[myGrid.getProperty("selection/index")];
  if (!custRecord){
    alert('You have not selected a customer');
  }
  else{
    var custNum = custRecord[2];
    alert('You have selected a customer');
  }
}
Alex (ActiveWidgets)
June 26,

This topic is archived.

See also:


Back to support forum