There are two properties in DataGrid where we can lock the visibility of the rows and columns in the DataGrid [here lock the visibility means, which are always visible ,like when scrolling they are not moved to and forth].
The property for ColumnLock is
lockedColumnCount
this takes the value to lock the number of Columns in the Display from left of DataGrid. Here horizontalscrolling locks the columns for visibility.
The property for RowLock is
lockedRowCount
this also takes the value to lock the number of rows in the Display from top of DataGrid. Here verticalscrolling locks the rows for visibility.
code Example:
<mx:DataGrid x=”277″ y=”331″ id=”dg” dataProvider=”{xml}”
lockedColumnCount=”3″ height=”96″ horizontalScrollPolicy=”on”
verticalScrollPolicy=”on” width=”397″>
<mx:columns>
<mx:DataGridColumn headerText=”Sl.No” dataField=”slno”/>
<mx:DataGridColumn headerText=”Product Name” dataField=”PNAME”/>
<mx:DataGridColumn headerText=”Pro ID” dataField=”PID”/>
<mx:DataGridColumn headerText=”Cat ID” dataField=”CAT_ID”/>
<mx:DataGridColumn headerText=”Cat Name” dataField=”CATEGORY”/>
</mx:columns>
</mx:DataGrid>
The below image shows the locking of two columns.

Enjoy the code !, happy Flexing.


May 22, 2008 at 11:13 pm |
Is it posible to lock the colums and rows dynamically? I have a requirement, the user must be able to select the lockcolumn count from a list .
May 27, 2008 at 7:13 am |
yes it is possible , dynamically , your logic will work.
regards,
kumar.
January 2, 2009 at 5:06 pm |
is it possible to lock a row in an Advanced DataGrid in a tree mode ?
January 9, 2009 at 4:33 am |
Hi,
It may be possible , i didn’t try it.But i think it is possible, will give a try and let you know.
regards,
kumar.
April 11, 2009 at 5:10 am |
is it possible to disable sorting for only the lockedRowCount in datagrid
September 10, 2009 at 6:42 pm |
does this possibility also exists for a grid ?
September 11, 2009 at 3:31 am |
No this possibility does not exit for Grid.Grid is different from that of the DataGrid.Grid is similar to Table Tag in Html [to arrange components and align them].
regards,
kumar.