Problem with TMSFMXGrid and Filtering

Hi,
when i try to filter a TMSFMXGrid i get an Error: "argument out of range"
I just use the built in Filtersystem. No programmatical settings.
Version: 2.8.0.
Delphi: XE6
BS: IOS
Maybe the reason is that i use more than one fixed row?
BR
Juergen Bucher

We have tried this with our filtering demo but couldn't see any issues. Perhaps you could send us your demo sample so we can investigate this here?


Kind Regards, 
Pieter

Hi Pieter, 

thanks for your response.
I went ahead and created a new project file, dropped down the TMSFMXGrid and enabled the DropDown Filtersystem (which I was referring to).
Then I filled it with some example values and tried to use it, which got me to the error. Under Windows it works as intended, for iOS I'm getting the "argument out of range" exception.
I will send in a demo file over the support page. 

Best Regards,
Juergen Bucher

Hi Jurgen ... I found a solution to this problem that seems to fix the issue on both windows and mac. From my experience, I get the "argument out of range" error when I apply a filter to the grid, and then attempt to sort the data by clicking the top-most fixed cell of a given column to perform the sort.

The fix to this is to simply unhide all the filtered columns just before you sort, then re-apply the filter again after the sort is completed.

To do this, you need to create the following 2 event procedures for your TMSFMXGrid:

procedure TMainForm.GridCanSortColumn(Sender: TObject; ACol: Integer;
  var Allow: Boolean);
begin
  //this prevents the "out of argument" or "out of range" errors when sorting with filters
  if (Sender as TTMSFMXGrid).Filter.Count > 0 then (Sender as TTMSFMXGrid).UnHideRowsAll;
end;

procedure TMainForm.GridColumnSorted(Sender: TObject; ACol: Integer;
  Direction: TSortDirection);
begin
  //this prevents the "out of argument" or "out of range" errors when sorting with filters
  if (Sender as TTMSFMXGrid).Filter.Count > 0 then (Sender as TTMSFMXGrid).ApplyFilter;
end;

Also ... another problem I found, was the filters are not working correctly when filtering numbers in a grid on a iOS Mac. The fix for this problem was to comment out some code in the FMX.TMSGridDataUtil.pas file .. you need to comment out the {$IFDEF MACOS} section located near line 402. If took a lot of searching, but the problem is the function StripThousandSep is not defined for a mac .. so the "Val" expressions in the "Matches" functions won't work on a Mac. Therefore, you need to comment out those lines so the "StripThousandSep" will work, and therefore, the filters will function correctly on a mac.

hopefully, the team over at TMS Software will see this message and fix that problem in the next version of the TMS Pack for Firemonkey. The current version I am using is version v2.8.0.1

hope that helps,

Dave Guindon

Thanks for reporting.

We can confirm both issues will be addressed in the next update.
  • Fixed : Issue with sorting & filtering rows in TTMSFMXGrid (v. 2.8.0.2)
Is it supposed to work with this version or is the update yet to come?
Just tested it on our iPhone/iPad after installing the update and I'm still getting the error, followed by some access violations.

Can someone confirm this? 
Thanks in advance!

Hi,


I tested the Drop-Down-Filter with Delphi XE 8 and the recent version of TMS FireMonkey Pack - It still won't work for me.
My last question regarding the update (see above) was unfortunately not answered either. 
I took the same approach as before and filled one column with two different ongoing values.
If I try to click on one of the two filter values I'm getting constant access violoations.

Have you tested this on iOS? 
 

Hi, 


We have investigated this here and have applied a fix for this issue. The next version will address this issue.

Kind Regards, 
Pieter

Hi,


I am able to filter columns now - but I have another Issue when using the MultiColumn property of the Drop-Down-Filter:

Steps to reproduce:

- Filter column A
- Filter is correct
- Filter column B
- Filter is still correct
- Reset filter with TTMSFMXGRID.RemoveFilter
- All entries are correctly shown again with no filter present
- Filter column A (again)
- Filter is not correct anymore -> previous column B filter is also active!

In the documentation it states "To remove the filter again at a later time, call TMSFMXGrid.RemoveFilter;". Am I doing something wrong or is this a bug?
(occurs on Windows and iOS)

Thanks in advance!

Best Regards,
Juergen Bucher


Hi, 


We have tested this here but are not able to reproduce this, can you perhaps send us a sample that is able to reproduce this? We have tested this here on our filtering demo.

Kind Regards, 
Pieter

Hi Pieter,


thanks for the quick response. I will send in a demo file over the support page right away.

Best Regards,
Juergen Bucher

Hi,


just to clear things up (if anyone else is wondering about this): 
I got mail from the TMS Support:
TMSFMXGrid.RemoveFilter is currently based on a single column filter, not on multi-column filter. They are investigating if they can improve the current behaviour. Calling TMSFMXGrid.Filter.Clear before the RemoveFilter will lead to the expected result.

Now I can work with it. Just wanted to leave a thanks to all people who tried to help.

Best Regards,
Juergen Bucher

In the next version you will be able to use


TMSFMXGrid1.RemoveFilter (clears filtering based on a single column filtering)
and/or
TMSFMXGrid1.RemoveFilters(clears filtering based on multi column filtering)

Kind Regards, 
Pieter