Unplanned
Last Updated: 06 Jul 2020 13:40 by ADMIN
Phil
Created on: 29 Jun 2020 10:58
Category: Grid
Type: Feature Request
5
Grouping with a Datatable as a DataSource

I recently implemented a Datatable-based grid utilizing the new features/enhancements released in v2.15.0. One notable feature omission that I noticed was the lack of grouping support. I did notice that there was another support item that mentioned OnRead not working with Grouping, but was unsure if that was the reason for the issues I am having or not.

I am using the OnRead() event for building my source from the DataTable, as the demo for using a DataTable shows, and experience a similar issue to that in the referenced support item (empty rows in the grid after attempting grouping, or "nothing" happening, depending on how I try and configure the grid/logic).

Is there a way to do this now, or can this functionality be added?

6 comments
ADMIN
Marin Bratanov
Posted on: 06 Jul 2020 13:40

Hi Phil,

We are aiming at the first third of August for 2.16.0.

On the aggregates - adding them with tags is the way to go. I suspect the issue you are hitting is this: https://feedback.telerik.com/blazor/1470690-aggregates-don-t-work-when-grouping-is-set-in-onstateinit. Could you take a look and see if the workaround helps in your case? If not, I'd suggest you open a support ticket and send me a simple runnable version of things so I can take a look. Hardoding some descriptor data would serve perfectly, actual business logic data and models are not needed.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Phil
Posted on: 06 Jul 2020 12:02

Thanks again Marin,

I have moved this to expandos for now. I have also switched this to not use OnRead for the moment so the grouping will apply. Is there a current timeframe for 2.16.0? Also, one other issue I am running into (and if it would be preferable for me to make a separate post about this, I will be sure to do so) is that aggregates I configure do not seem to be applying. I have attempted to apply them in the .razor markup and the c# code, but the grid never seems to display any aggregates.

 

In the markup, I attempted to have a loop going through the aggregates I need to apply that are passed back from the API and generate <GridAggregate>s. When I do this, the aggregates don't appear to apply and it seems to break the grouping, though I can't find an actual exception in the output window.

 

In the c# code, within the OnStateInitHandler, I tried adding the aggregates to the AggregateFunctions collection within the GroupDescriptors, but this also does not appear to generate any aggregates. This does not appear to break grouping, but doesn't seem to do much of anything.

 

I also couldn't find any specific documentation regarding "programmatically defined" aggregates, so I am unsure if defining these programmatically is currently supported at all. I have attached snippets of each example that I mention for aggregates.

Attached Files:
ADMIN
Marin Bratanov
Posted on: 03 Jul 2020 11:52

Hi Phil,

The approach from the docs on using OnRead with Grouping that will be available in 2.16.0 would work for expando objects too - utlimately, you would be giving the grid a List<object> anyway, but the underlying data can still be expandos. I'm attaching a preview based on both the current expando sample, and the future onread approach. Of course, this won't work until 2.16.0.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Phil
Posted on: 02 Jul 2020 15:59

Thank you for the update Marin. Unfortunately, I am unable to create models for this particular use case, as this is displaying dynamic data that could contain any number or combination of fields. If ExpandoObject supports, or is intended to support, Grouping, we can look into converting the Datatable returned from the API into an ExpandoObject dynamically and then using that for the grid. Can you confirm whether ExpandoObject does or will support these features?

ADMIN
Marin Bratanov
Posted on: 02 Jul 2020 13:47

I am reopening this, as the DataTable is too special a case - the grid does not actually bind to a data table, but to an IEnumerable<TItem>, and the way the demo shows to use a data table is through converting it to certain objects. These cannot work with grouping, though, because grouping requires completely different shape of the data that the grid generally hides from you (you can preview info on that here). The Dictionary approach that is easy to use with a DataTable to simulate a plain collection cannot be converted to the special recursive group objects that are needed, so extra code will be required in any case.

At this point the better advice I can offer is to consider making models for the data to use the grid in the true Blazor way - with models. If that's not possible, ExpandoObjects are a tad more flexible and you may be able to use those (example).

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
ADMIN
Marin Bratanov
Posted on: 29 Jun 2020 11:39

Hi Phil,

Indeed, this is the cause, and you can Follow the implementation of that feature in the page you linked.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.