I have a form with a DBadvGrid.
In the last 20 years,I created a form, serving as parent, with sorting up/down (multiple cols) saving and restoring col-names, sizes, headers, finding and filtering.
Most of the features I made are standard in the TMS grid.
However, with some items I have problems:
Sorting
Its only working with pagemode=false; Can I do the sorting in the data-query?
After the first sort, the NULL record stays on top
How to save the last sort choice (column(s) and up/down)?
Headers; what is the best way to save the headers?
Is there a search row, where you can enter data and there is a search in the selected(ordered) col?
How to search in the selected column(sorted) the first row starting with entered text?
How to filter and only showing rows the filter-text ?
How to insert a checkbox for row selection at col 1, moving all other colls to the right
What is AutoFormat and how do I use AutoSortForGrouping?
What do Fixedcolls and Full?
The header color does not change on sort (color and mirror color entered)
see demo under Demo\DBAdvGrid\ADOSort for dataset based sorting
If this concerns single column sort, the setting is under grid.SortSettings.Column / grid.SortSettings.Direction
Get header text values via grid.Cells[x,0]: string and save these where you want
grid.Find()
Either perform dataset filtering (pagemode = true) or grid filter functions (pagemode = false)
See demo Demo\DBAdvGrid\ADOSelection for a checkbox based row selection example
AutoFormat will apply system locale settings for formatting floating point DB field values.
AutoSortForGrouping applies to the grouping function and will perform a sort before creating the groups
FixedCols sets the nr. of fixed columns. I'm not sure in what context you refer to Full here
I'm not sure what you do, the grid itself has no built-in functionality to change a header color when doing sorting.
Where you expect it and after what specific action?
Thank you for your extensive answer.
Wow, just learning the amazing posibilities of your grid!
I use C:\Users\Public\Documents\tmssoftware\TMS VCL UI Pack Demos\DBAdvGrid\ADOSort
There is no sorting action. There appears verry shallow arrows up and down.
+3.Do you consider making a procedure for save/restore all settings (column order, size, header, filter, sort columns and direction)? After create you have the same screen as if you left it.
found it, SearchFooter. Is it posible to add buttons and edit fields to the footer?
I would like to add a filter checkbox and edit field and a button and editfield to alter the col header.
clear, works fine.
Found it: dbAdvGrid.Columns.insert(1). Only after insert the first col is overwritten and a empty col is added as last column. After removing the column the inserted title remeans, the data of the first coulmn reappears and the column on the right is removed.
procedure TForm1.bInsertColClick(Sender: TObject);
var
Col: TDBGridColumnItem;
begin
if not cbPresent then
begin
Col := DBAdvGrid1.Columns.Insert(1);
Col.Editor := edDataCheckBox;
Col.Header := 'Kies';
Col.Alignment := taCenter;
Col.Width := 40;
end;
cbPresent := true;
end;
procedure TForm1.bRemoveColClick(Sender: TObject);
begin
if cbPresent then
DBAdvGrid1.Columns[1].Destroy;
cbPresent := false;
end;
sorry, Sortsettings.fixedcols and Sortsettings.full.
I filled in Sortsettings, the bitmaps down-,up, indexup and indexdownglyph.
Only the indexdownglyph appears on header click, second click the shallow up (default) appears
and not my glyph.
You implemented the Ctrl on mouse scroll changing the font size
If I may suggest a (shift) key for scrolling fast scroll + shift: scroll by 10 lines or page
That does not help.
I gave you the code for the create and delete I used, and printscreens of what happens here.
procedure TForm1.bInsertColClick(Sender: TObject);
var
Col: TDBGridColumnItem;
begin
Col := DBAdvGrid1.Columns.Insert(1);
Col.Editor := edDataCheckBox;
Col.Header := 'Kies';
Col.Alignment := taCenter;
Col.Width := 40;
end;
procedure TForm1.bRemoveColClick(Sender: TObject);
begin
DBAdvGrid1.Columns.delete(1)
end;
1.Can you tell me what I'm doing wrong?
2.Why stay de empty/NULL rows on top after sort?
3.Why does the blue arrow down appear (sort A-Z) but the arrow up (set in the properties) not? (Sort Z-A)
I could not run your app, it has references to databases not available here.
If you create code to reproduce, please use a TClientDataSet to make it really usable everywhere.
procedure TForm1.bMaakClick(Sender: TObject);
var
Col: TDBGridColumnItem;
begin
if not Kiesveld then
begin
DBAdvGrid1.InsertCols(1,1);
DBAdvGrid1.AddCheckBoxColumn(1);
DBAdvGrid1.ColWidths[1] :=40;
DBAdvGrid1.Cells[1,0] := 'Kies';
end;
Kiesveld := true;
end;
procedure TForm1.bVerwijderClick(Sender: TObject);
begin
if Kiesveld then
DBAdvGrid1.RemoveCols(1,1);
Kiesveld := false;
end;
Remains 1 thing,
From the glyphs I load in IndexDownGlyph (see reply of 14 feb) and Up, only the down glyph is shown.
(not the up).
After reopening the form and preforming StringToColumnStates none of the glyphs is shown.
Hi,
I hope you have the time to look into my questions.(above)
I have a suggestion to; when the properties of a row are extended with an ID, this field can be filled with - if pressent - the autoincfield of the record and so creating a possibility to acces the table data of the selected row
One more thing (I really need your help) is when you enter a unique search item which only is on the last line, you have to move yourself to that position, and when you press the up and down button the screens shifts out to the top.
Sort glyphs are drawn as transparent bitmaps with the transparency color set by the left bottom pixel.
Your up glyph uses the arrow color as left bottom pixel, hence it is drawn transparent.