Is it possible to freeze last column to the right side of the grid?
All the demos that I came across shows freezing 1st or 1st & 2nd column to left side of the grid.
I tried using frozen:true
property to only last column in colModel, but its not working.
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.The current implementation of frozen columns in jqGrid don't allows to freeze last columns to the right side of the grid. So I don't see any simple way to implement your requirements in jqGrid.
The reason of the complexity is in the implementation of frozen columns in jqGrid. The method
setFrozenColumns
examinecolModel
from the left (from the first index of thecolModel
array) at the beginning (see the part of the source code). It finds the max index ofcolModel
which havefrozen: true
property and then makes the copy of the columns of the grid in the separate div. In other words jqGrid take in considerations only first columns ofcolModel
which havefrozen: true
property. All other properties which havefrozen: true
will be ignored. Then jqGrid creates always the div with left frozen columns only. So the usage of frozen columns on the right side of the grid not provided.