You see that all the demos freeze only the columns on the left side, because it is simply impossible with jqGrid to freeze columns or columns of the right side that are not adjacent (try to freeze columns 1 and 3, but not 2, this will freeze only column 1. Similarly, freezing columns 1, 2 and 4, but not 3, only columns 1 and 2) will freeze.
Below is a piece of code from jqGrid that imposes such a rule (see while loop with comment from left, no breaking frozen ). If you are serious about allowing freezing on the right column, you can try making changes to the jqGrid code to suit your requirements.
setFrozenColumns : function () { return this.each(function() { if ( !this.grid ) {return;} var $t = this, cm = $tpcolModel,i=0, len = cm.length, maxfrozen = -1, frozen= false; // TODO treeGrid and grouping Support if($tpsubGrid === true || $tptreeGrid === true || $tpcellEdit === true || $tpsortable || $tpscroll ) { return; } if($tprownumbers) { i++; } if($tpmultiselect) { 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++; }
source share