I find your question very interesting, so +1 from me.
It seems to me that the usage of colspan=2
is what you really need. To have the same number of the columns in the rows having colspan=2
I suggest to hide the next <td>
element in the row:
{
name:'a',index:'a', width:50,
cellattr: function(rowId, tv, rawObject, cm, rdata) {
if (Number(rowId) < 5) { return ' colspan=2' }
}
},
{
name:'b',index:'b', width:50,
cellattr: function(rowId, tv, rawObject, cm, rdata) {
if (Number(rowId) < 5) { return ' style="display:none;"' }
}
}
I tested the implementation only a few time, but it seems to work:
The demo you can see live here.
UPDATED: Another answer shows how can be used rowspan
attribute in jqGrid.