You are seeing all demos to be freezing only left side columns, because it simply is not possible with jqGrid to freeze right hand side columns or columns that are not adjacent (Try freezing columns 1 and 3 but not 2, this will freeze only column 1. Similarly freezing columns 1, 2 and 4 but not 3 will freeze only columns 1 & 2).
Below the code snippet from jqGrid, which imposes such a rule (refer while loop with comment from left, no breaking frozen
). If you are serious about allowing a right-side column to be frozen, you can try to make modifications to the jqGrid code as per your requirements.
setFrozenColumns : function () {
return this.each(function() {
if ( !this.grid ) {return;}
var $t = this, cm = $t.p.colModel,i=0, len = cm.length, maxfrozen = -1, frozen= false;
// TODO treeGrid and grouping Support
if($t.p.subGrid === true || $t.p.treeGrid === true || $t.p.cellEdit === true || $t.p.sortable || $t.p.scroll )
{
return;
}
if($t.p.rownumbers) { i++; }
if($t.p.multiselect) { i++; }
// get the max index of frozen col
while(i<len)
{
// from left, no breaking frozen
if(cm[i].frozen === true)
{
frozen = true;
maxfrozen = i;
} else {
break;
}
i++;
}