Class
zebkit.data.Matrix
mixed with <zebkit.EventProducer> <zebkit.data.DataModel> |
<zebkit.data> |
Matrix model class.
zebkit.data.Matrix
([data], [rows], [cols]
)
Parameters:
-
[data]
<Array>the given data as two dimensional array
-
[rows]
<Integer>a number of rows
-
[cols]
<Integer>a number of columns
Example:
// create matrix with 10 rows and 5 columns
var matrix = zebkit.data.Matrix(10, 5);
matrix.get(0,0);
matrix.put(0,0, "Cell [0,0]");
// create matrix with 3 rows and 5 columns
var matrix = zebkit.data.Matrix([
[ 0, 1, 2, 3, 4 ], // row 0
[ 0, 1, 2, 3, 4 ], // row 1
[ 0, 1, 2, 3, 4 ], // row 2
[ 0, 1, 2, 3, 4 ], // row 3
[ 0, 1, 2, 3, 4 ] // row 4
]);
// create matrix with 0 rows and 0 columns
var matrix = zebkit.data.Matrix();
// setting value for cell (2, 4) will change
// matrix size to 2 rows and 3 columns
matrix.put(2, 4, "Cell [row = 2, col = 4]");
public | <Object> | get (row, col) |
public | <Array> | getCol (col) |
public | <Object> | geti (index) |
public | <Array> | getRow (row) |
public | void | insertCol (col, [data]) |
public | void | insertCols (col, count) |
public | void | insertRow (row, [data]) |
public | void | insertRows (row, count) |
public | void | put (row, col, obj) |
public | void | puti (i, obj) |
public | void | removeCols (begcol, count) |
public | void | removeRows (begrow, count) |
public | void | setCols (cols) |
public | void | setRows (rows) |
public | void | setRowsCols (rows, cols) |
public | void | sortCol (col, [f]) |
public
chainable
insertCol (col, [data] )
Insert the column data at the given column Parameters:
|
public
chainable
insertCols (col, count )
Insert the given number of columns at the specified column Parameters:
|
public
chainable
insertRow (row, [data] )
Insert the row data at the given row Parameters:
|
public
chainable
insertRows (row, count )
Insert the given number of rows at the specified row Parameters:
|
public
chainable
put (row, col, obj )
Set the specified by row and column cell value. If the specified row or column is greater than the matrix model has the model size will be adjusted to new one. Parameters:
|
public
chainable
puti (i, obj )
Set the specified by index cell value. The index identifies cell starting from [0,0] cell till [rows,columns]. If the index is greater than size of model the model size will be adjusted to new one. Parameters:
|
public
chainable
removeCols (begcol, count )
Remove specified number of columns from the model starting from the given column. Parameters:
|
public
chainable
removeRows (begrow, count )
Remove specified number of rows from the model starting from the given row. Parameters:
|
public
chainable
setCols (cols )
Set the given number of columns the model has to have. Parameters:
|
public
chainable
setRows (rows )
Set the given number of rows the model has to have. Parameters:
|
public
chainable
setRowsCols (rows, cols )
Set the given number of rows and columns the model has to have. Parameters:
|
public
void
sortCol (col, [f] )
Sort the given column of the matrix model. Parameters:
|
public
![]() cols
Number of columns in the matrix model |
public
![]() rows
Number of rows in the matrix model |
- cellModified ( src, row, col, old )
- matrixColInserted ( src, rowIndex )
- matrixColInserted ( src, colIndex )
- matrixResized ( src, pr, pc )
- matrixSorted ( src, sortInfo )
cellModified
Fired when the matrix model cell has been updated.
Parameters:
|
matrixColInserted
Fired when a row has been inserted into the matrix.
Parameters:
|
matrixColInserted
Fired when a column has been inserted into the matrix.
Parameters:
|
matrixResized
Fired when the matrix model size (number of rows or columns) is changed.
Parameters:
|
matrixSorted
Fired when the matrix data has been re-ordered.
Parameters:
|