//Demo of SetRowValues
//and GetRowValues
var oGridData = XSIFactory.CreateGridData() ;
oGridData.ColumnCount = 2;
oGridData.RowCount = 10;
var aColVals = new Array( 2 ) ;
for( i = 0 ; i < oGridData.RowCount ; i++ )
{
aColVals[0] = i ;
aColVals[1] = i + 10 ;
oGridData.SetRowValues( i, aColVals ) ;
}
//Check the results
for( i = 0 ; i < oGridData.RowCount ; i++ )
{
// Return value is a SAFEARRAY so we need to convert
// to JScript Array to read the values
var aSafeArray = oGridData.GetRowValues( i ) ;
var aRead = new VBArray( aSafeArray ).toArray() ;
if ( aRead[0] != i ||
aRead[1] != ( i + 10 ) ) {
LogMessage( "Unexpected" ) ;
}
}
|