Am just getting the hang of the very versatile and impressive TeeGrid. Having
checkboxes is a great addition; and as I understand, they are created as a
separate column (not to be combined with an existing one).
Was able to get the checkboxes to appear using:
Code: Select all
MyTeeGrid.Columns[MyColumn].Render := TBooleanRender.Create
Another question related to visual aspects came up with sorting. Since am using
TVirtualModeData (which I presume is so fast because it gets the
data from the given source using GetData only when it needs to display it),
am doing the sorting externally, and then re-sending the data (kind of as a result of a new query)
to be displayed. Noticed that there are methods to get the little upward/downward
pointing arrow to be displayed, but could not get a downward pointing arrow
(for Descending) to be displayed.
The code is as follows (_g at end of variable indicates globality)
My obliged for your comments and kind help.
Code: Select all
Procedure display_grid; BEGIN Data_tee_G := TVirtualModeData.Create( Nr_Cols_G,Nr_Rows_G,60); MyTeeGrid.Header.SortRender := TSortableHeader.Create(MyTeeGrid.Header.Changed); MyTeeGrid.Header.SortRender := CreateSortable; // will only use this to display sorting arrow Data_tee_G.OnGetValue := GetCell; MyTeeGrid.Data := Data_tee_G; // bind virtual data MyTeeGrid.Header.Sortable := True; END; procedure TMyForm.TeeGridClickedHeader(Sender: TObject); Var is_ascending:Boolean; cur_tc:TColumn; cur_tc_i:SmallInt; BEGIN cur_tc := (Sender as TColumn); // current column to be sorted cur_tc_i := (cur_tc).Index; If sorted_col_status_g[cur_tc_i] = -1 Then // keep a global for the direction of each sorted column is_ascending := True Else is_ascending := False; Data_tee_G.IsSorted(cur_tc,is_ascending); // try to set variable 'is_ascending' // do the external sorting routine here (not shown) // provide the grid with the new, sorted data. display_grid; // populate grid with new sorted data. END;