Posted 6 July 2021, 8:04 am EST
Greetings:
Due to my company requirements I have to use TrueDbGrid in Visual Basic.Net.
I’m trying to use this two features: GroupBy and FilterBar. I have problems with both of them. The version I’m using is ComponentOne Studio for WinForms (.NET 4.0) 4.0.20183.343 2018.V3 4.0.20202.438
But first of all, I will explain a little about the structure of the application and why I need to bind the data this way. The Data Access Layer is made with Dapper. https://github.com/DapperLib/Dapper.
Dropping Dapper for other solution to access data is NOT negotiable, so the first step in the tutorials: Binding TrueDBGrid to a dataset doesn’t apply here.
Dapper returns objects instead of datasets, usually in the form of an IEnumerable(Of Poco) as the result of any query. I convert that IEnumerable to a SortableBindingList for multiple purposes.
To keep the designer’s layout I’m using SetDataBinding method with a BindingSource to bind the data at runtime and holdFields = True.
First: I need it to bind data in dual mode with WinForms (the Poco object implements INotifyPropertyChanged to make this possible), this way I can get the changes from the database to refresh the interface and viceversa.
Second: binding the data to a BindingList instead of a DataSet breaks sorting by clicking the header, a generic BindingList is not enough to fix it, so I implemented a custom SortableBindingList to be able to sort the columns by clicking on them.
I made a simplified mockup example for you to replicate it easily, can find it in the zip. It mimics application’s structure the best I could. Any question or doubt ask me what you need and I’ll provide it.
So, about the problems I have with TrueDbGrid, lets begin with the first one: Group By.
Following the steps detailed in the Tutorial 17: Creating a Grouping Display of the TrueDBGridManual.pdf, in the designer I set DataView to GroupBy and GroupAreaVisible to True. The GroupArea appears and I can drag columns in and out of it. Problem is inconsistency: sometimes works as expected: sort the column first, then group it, and sometimes don’t.
In the example application you can try it grouping in the following order: click “Load 12 Pre-Configured” button, drag and drop column One, then column Two. Column One is sorted and then grouped by, column Two is not grouped or sorted, making the hierarchy useless.
Now use the clear button and click “Load 12 Pre-Configured” again. This time drag and drop column Four, then column Two. Column Four is sorted and then grouped by, so is column Two. I don’t know why sometimes works and sometimes don’t.
The second issue is: Filter Bar doesn’t work at all.
Following the steps detailed in the Tutorial 21 : Adding a FilterBar of the TrueDBGridManual.pdf, simply states that all you need if you want the standard filter is to set the AllowFilter and FilterBar properties to True and that’s it.
Unfortunately it doesn’t work at all. FilterBar appears and I can write on it, but nothing happens. If I capture the FilterChange Event I can check it is firing it, but as the tutorial states, this is for handle the filter myself, and that’s something I don’t want to do, I just want the standard, simple filter to work.
Thanks for the help and best regards.TDBGridNoFilter.zip