Current filter:
                                You should refresh the page.
                                  • Can I fix some rows in a TcxGrid, so that when I use the vertical scroll, the first line(s) in a grid are always visible?

                                1 Solution

                                Creation Date Importance Sort by

                                You can implement it by handling the OnGetDisplayText or OnGetDataText events of all columns in your Grid View. Within the handler, you should set the AText var-parameter to the value taken from the first dataset record. However, this approach works only for browsing data. You won't be able to edit values of a fixed row because in-place editors take values directly from the underlying dataset record.

                                [Delphi]
                                procedure TForm.cxGridDBTableViewNameOnGetDisplayText(Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord; var AText: string); var AView : TcxGridDBTableView; s : string; begin AView := TcxGridDBTableView(Sender.GridView); s := VarToStr(AView.DataController.Values[0, Sender.Index]); if ARecord.RecordIndex = AView.Controller.TopRecordIndex then AText := s; end;

                                [UPDATED:]

                                In the VCL version 17.2, we implemented Fixed Data Rows functionality in Table and Banded Table Views. End-users can anchor specific data rows to either the top or bottom of the grid. 


                                To turn on this functionality you need to enable the GridView.OptionsCustomize.DataRowFixing option and set the GridView.FixedDataRows.PinVisibility property to the rpvAlwaysrpvHotTrack or rpvRowHotTrack values. Then you can click the Pin icon of a record and choose where you wish to fix it to the top or bottom

                                • Rafael Piccolo 06.27.2012

                                  It seems that this workarround works only for DBTableView. I tried that in an unbound TableView and it works only for scrolling up. When scrolling down, it just moves up what is already on screen and call the event just for the bottom records (that were not visible).

                                • Rafael Piccolo 06.27.2012

                                  I got it. I have to invalidate the TableView in the TopRecordIndexChanged event with the HardUpdate option:
                                  TcxGridBandedTableView(Sender).Invalidate(True)