:: Forum >> Version 1 >>

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
Wednesday, June 23, 2004
Tony, what is seqnumber? Can you post (send me) the code?
Alex (ActiveWidgets)
Thursday, June 24, 2004
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
Friday, June 25, 2004

function switchCustomerdisData )
{
  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)
Saturday, June 26, 2004



This topic is archived.

Back to support forum

Forum search