The Matrix data structure is essentially a 2-dimensional array.
A matrix can be initialized with the
.ds.matrix() function of a JSAV instance.
data argument is provided, it should be an array of arrays, all of the
same length. If only
options argument is provided, it needs to specify options
columns specifying the size of the matrix.
Matrix supports the common options and position options. Additional option that can be specified:
table. Defaults to
For example, this would create a 2x2 matrix:
var m = jsav.ds.matrix([[0, 1], [2, 3]]).
An empty 5x8 matrix using the matrix style could be created like this:
Swaps two values of the matrix, namely (row1, col1) with (ro2, col2).
Recalculates the layout for the data structure.
Like for the array, there are similar functions in the matrix that take the row number as the
first argument and the rest of the arguments similarly than the corresponding array function.
These functions are
toggleClass. So, for example, whereas the array
.addClass(col, className), the matrix has a function
.addClass(row, col, className).