Sorry, my bad, I should have noted and mentioned that in the grid the [col] is evaluated once during the grid definition, but the values between [col] and [/col] are done on each row so my example was incorrect.
So here is HTML that shows how to accomplish what you are looking for:
[ttl]Grid Demo[/ttl]
[form program=grid_sep7]
[subttl]Grid below shows locking columns[/subttl]
[grid mygrid size=50% program=grid_sep7]
[col ttl="Col1" width=10][input col1$ (lck1$)][/col]
[col width=15 ttl$="Col2"][input col2$ class="text_blue,font_bold" (lck2$)][/col]
[col ttl="Col3" width=15 class="align_center"][input col3$ (lck3$)][/col]
[/grid][/form]
You will notice that the (lckx$) option is inside the [col] short code tags thus will be evaluated on each row.
Here is the associated program that loads the grid and the lock settings.
load_grid:
enter gridhdl
!
open (hfn,iol=grid_iol)"*memory*"
gridhdl=lfo
!
for rowno=1 to 15
col1$="Col1/Row"+str(rowno)
col2$="Col2/Row"+str(rowno)
col3$="Col3/Row"+str(rowno)
!
if mod(rowno,2)=0 \
then lck1$="locked" \
else lck1$=""
if mod(rowno,3)=0 \
then lck2$="locked" \
else lck2$=""
if mod(rowno,4)=0 \
then lck3$="locked" \
else lck3$=""
!
write (gridhdl)
next rowno
!
end
!
grid_iol: \
iolist col1$,lck1$,col2$,lck2$,col3$,lck3$
Now because of the way a grid works, when you run this the locked cells will not show as grey background. This is because locked cells in a grid cascade the cell background color. If you want them to show as a grey background, you can get around this by adding a class of something like "dynalock" to the [grid] definition then in your system setup add the following custom CSS line:
div.dynalock input[readonly] { background-color: var(--clrbck-locked) !important; }