I want to change the default Index of the combobox for the Filter in the FNCDataGrid. The standard is "Equals" but i want it to be "Start with".
Also i want to change the Strings in the Combobox in German Language.
What to do to change this?
Hi,
It's not ideal but with this code you can change it:
fd := TTMSFNCDataGridDataFilterData.Create(nil);
try
fd.&Type := gftStartsWith;
(TMSFNCDataGrid1.FilterEditors[1, 1] as TTMSFNCDataGridFilterPanel).SetFilter(fd);
finally
fd.Free;
end;
We'll add on our list a way to set this with one property instead.
For the language, you can find all strings in:
TMSFNCDataGrid1.Options.Localization
for example
TMSFNCDataGrid1.Options.Localization.FilterTypeStartsWithText := 'MyString';
Be aware that you have to set the Localization properties before enabling the filter row.
In addition, the above code is only applicable to the filter row editor, the combobox which is used in the filter popup cannot be change right now. I'll add a new property at column level to control this.
In the next version you'll be able to set a default type for both the filter combobox in the popup, as in the filter row editor with the following code:
TMSFNCDataGrid1.Columns[1].AddSetting(gcsFilterDefaultType);
TMSFNCDataGrid1.Columns[1].FilterDefaultType := gftStartsWith;
The last Version of TMS FNC UI Pack i got was 6.3.0.1.
In this Version there is no Property FilterDefaultType:
TMSFNCDataGrid1.Columns[1].AddSetting(gcsFilterDefaultType);
TMSFNCDataGrid1.Columns[1].FilterDefaultType
Error undeclared Property
FilterDefaultType is a new property that is not yet available. It will be available in 6.3.0.2
TMS FNC FNC UI Pack Version 6.3.0.2
With this Version i can do following:
Code
//DataGrid Filterbox vorbelegen
with frmMain.DataGrid do
begin
BeginUpdate;
Clear;
Options.Localization.FilterTypeStartsWithText := 'Startet mit';
Options.Localization.FilterTypeEndsWithText := 'Endet mit';
Options.Localization.FilterTypeContainsText := 'Enthält';
Options.Localization.FilterTypeNotContainsText := 'Enthält nicht';
Options.Localization.FilterTypeEqualText := 'gleich';
Options.Localization.FilterTypeNotEqualText := 'nicht gleich';
Options.Localization.FilterTypeSmallerThanText := 'kleiner';
Options.Localization.FilterTypeLargerThanText := 'größer';
Options.Localization.FilterTypeLargerOrEqualThanText := 'größer oder gleich';
Options.Localization.FilterTypeSmallerOrEqualThanText := 'kleiner oder gleich';
Options.Localization.FilterTypeEmptyText := 'leer';
Options.Localization.FilterTypeNotEmptyText := 'nicht leer';
DataGrid.ColumnCount := ColMaxK + 1;
for i := 0 to ColMaxK do
begin
DataGrid.Columns[i].AddSetting(gcsFilterDefaultType);
DataGrid.Columns[i].FilterDefaultType := gftStartsWith;
end;
// Grid einstellen für die Anzeige
GlobalFont.Name := FontNameGlobal;
Options.Selection.Mode := gsmSingleRow;
Options.Filtering.Enabled := True; // Filter im Header einschalten
Options.Sorting.Enabled := True; // Sortierung im Header
CellAppearance.FocusedLayout.Fill.Color := clGridSelected; // Selektierte Zeile in Gelb anzeigen
CellAppearance.SelectedLayout.Fill.Color := clGridSelected;
CellAppearance.FixedLayout.Fill.Color := clGridHeader; // Headerzeile im Grid
CellAppearance.ShowFocus := False;
/Code
I hope this is the correct way to do it.
It works as espected but there are some problems when not using the „Clear Filter“ icon.
So i set the filter to „bad“ like this in Picture 1.
The filtering works like expected.
Then i close the filter with ESC.
Then i click again on the filter icon and delete the text „bad“, the grid shows no entry like in Picture 2.
I close the Filter with ESC.
Then i click again on the filter icon and Picture 3 appears.
The Combobox was set to „Leer“ (empty), my selected Filter choice was gone.
But if i leave the Filter and click the Filter again, the combobox show „Started mit“ , that is correct.
Maybe you can do something like „clear Filter“ when the Editfield is empty?
Hi,
Thanks for the feedback, I'll check out this behavior as soon as possible and get back to you
We've applied improvements, next version will address this. Thanks for the feedback!