CGrid:SetRow
The SetRow method stores an array of values to a grid row.
bSuccess = G:SetRow( array, nRow )
bSuccess = G:SetRow( array, nRow, nCols )
bSuccess = G:SetRow( array, nRow, nColMin, nColMax )
where
array is a Lua array containing the data.
nRow is the row index. Data is stored in all columns in the row.
nCols is the number of columns to set. The array data are stored starting at column 1. The column range is clipped to the range [1, GetNumCols].
nColMin, nColMax are the indices of the beginning and ending grid columns. The column range is clipped to the range [1, GetNumCols].
bSuccess is the returned success code. On success it is true, otherwise false.
The following script creates a grid and stores numbers in columns 1 through 5 and rows 1 through 3. The script retrieves data from column 2, row 2:
|
-- new grid with 3 cols, 10 rows, 1 Sheet |
|
-- set 5 columns in row 1 |
|
-- set 5 columns in row 2 |
|
-- set 5 columns in row 3 |
|
-- specify column 2, row 2 |
|
-- result: Cell[2][2] = 5 |
|
-- setup a table of data |
|
-- set data in row r (= 2) |
|
-- result: Cell[2][2] = 101 |
The following script creates a grid like the one above. The script sets data in row 2, columns 2 through 3:
|
-- new grid with 3 cols, 10 rows, 1 Sheet |
|
-- set 5 columns in row 1 |
|
-- set 5 columns in row 2 |
|
-- set 5 columns in row 3 |
|
-- specify row 1 and columns |
|
-- result: Cell[2][2] = 4 |
|
-- setup a table of data |
|
-- set data in row r (= 2) |
|
-- result: Cell[2][2] = 100 |