I just wrote the answer to another question, where I described how to create a grid with a dynamic number of columns (the number of rows is always dynamic in jqGrid). It seems to me that you can display any matrix. In this case, you can make the code simpler because you can use common column names such as "1", "2", etc. (Or "Col. 1", "Col. 2", etc.) etc.
I changed the code so that it uses an array of arrays (a matrix) instead of an array on objects with named properties. So jqGrid will look like this:

or that:

depending on JSON input data.
The full demo can be found here . The full JavaScript demo code can be found below:
var mygrid=jQuery("#list"), cmTxtTemplate = { width:40, align:"center", sortable:false, hidden:true }, currentTemplate = cmTxtTemplate, i, cm = [], maxCol = 30, dummyColumnNamePrefix = "",
The easiest way to transpose the matrix (flip it along the main diagonal) is on the server. If you cannot do this, you can create and populate the transposed matrix inside the page function (see My code above) and simply replace the row part of obj with the transposed matrix.
Oleg
source share