Unplanned
Last Updated: 07 May 2019 15:52 by Anthony
Anthony
Created on: 17 Apr 2019 22:00
Category: GridView
Type: Feature Request
4
RadGridView: Add support for exporting hierarchy in MVVM manner

The built-in export capabilities for the RadGridView are clunky and not well though out. Additionally, it doesn't fully support exporting hierarchical child data. (You can do it, but you have to go through a good bit of song and dance for something that I've seen other tool sets do automatically.)

I'd like to see the option fully baked that doesn't require code-behind (allowing an MVVM approach). And asynchronous methods that uses standard async-await conventions.

5 comments
Anthony
Posted on: 07 May 2019 15:52
You're welcome, and thank you for getting on this request. I have to say I really enjoy the fact that my feedback is honestly looked at - unlike some places.
ADMIN
Yoan
Posted on: 07 May 2019 15:45
Hello Anthony,

Thank you for the additional information.

I have approved the request. Please note that I have modified the title with the relevant information. You can subscribe to this item in order to get notified when we start working on it. 

Regards,
Yoan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Anthony
Posted on: 24 Apr 2019 21:13

I forgot to answer your final question about MVVM. I'm open to anything that that keeps my UI out of my view-model and keeps anything non-UI out of my code behind (I'm not so religious as to say nothing can be in code-behind).

For example, providing a command property that automatically passes through a special stream that can be consumed by your exporters. Here's off the top of my head to give you an idea...

<telerik:RadGridView ... ExportCommand={Binding ExportCommand, Mode=OneTime} .../>

...

ExportCommand = new DelegateCommand(async data => await ExportDataGridAsync(data));

...

async Task ExportDataGridAsync(object data)

{

if (data is GridViewStream gridStream) {

var provider = new XlsxFormatProvider();

// create stream (e.g. to create a file) and whatever else

await provider.ExportAsync(gridStream, stream);

}

}

Anthony
Posted on: 24 Apr 2019 20:52

Yoan,

It mainly ties together and most of the clunkiness I was referring to has to do with the hoops to get the hierarchical data. (I hated the process enough that to do what I wanted I created a special exporter class using your XlsxFormatProvider. I could easily invoke it through a command in my view-model. It was more involved, but it wasn't cryptic and it was MVVM.)

I'll go into some detail. Right now, in order to export you have to either use an event handler to capture the RadGridView in your code-behind, or you have to pass its reference to your view-model thereby leaking UI implementation. At that point, it's simple enough to create your stream and call the Export method. It's just not graceful for MVVM. The real clunkiness comes into play if you want to capture your hierarchical data. At that point, you need to add a handler for the ElementExported event where you capture the context for the child grid and then export it's contents. It's a very non-MVVM approach.

Anthony

ADMIN
Yoan
Posted on: 24 Apr 2019 16:10
Hello Anthony,

The request for exporting hierarchical RadGridView out-of-the-box is a reasonable one and I will log a feature request for it. 

In order to assist you further, may I ask you to share which export method you are using and what are the other problems with it? Also, may I ask you to share your expectations for MVVM support? Do you want a built-in export command?

Regards,
Yoan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.