Hi guys.
In order to allow the user to export raw data from a Dashboard item, I need to handle the DataInspectorExtensionOptions.onGridInitialized event ( https://docs.devexpress.com/Dashboard/401194/common-features/underlying-and-displayed-data/data-inspector ).
Would you have a tip on how I could modify the Extension Dashboard.cs to have access to the DataInspectorExtension Class ( https://docs.devexpress.com/Dashboard/js-DevExpress.Dashboard.DataInspectorExtension ) so that I could get hold of this event and be able to set its dxGrid instance options?
Thanks in advance.
Ivan
(Wisej 2.2.43.0 – C# – SQLServer)
Hi Ivan,
This is a client-side configuration that you can handle by attaching to this.dashboard1.ClientSideEvents.BeforeRender (similar to the ItemClick client-side event).
You can use sender.getDashboardControl() to get the client-side dashboard. It will look something like this:
this.dashboard1.ClientSideEvents.BeforeRender = @" function(sender) { // configure dxGrid startup. var control = sender.GetDashboardControl(); control.unregisterExtension('data-inspector'); control.registerExtension(new DevExpress.Dashboard.DataInspectorExtension(control, { allowInspectAggregatedData: true, allowInspectRawData: true, onGridInitialized: function (args) { args.component.option({ export: { enabled: true } }) } })); }";
You also need to make sure the JSZip JS library is loaded into the iFrame of the Dashboard Control before initializing it. You can use the ScriptManager for that:
private void dashboard1_Init(object sender, EventArgs e) { // register DashboardClient.js this.dashboard1.ScriptManager.Scripts.Add(new ScriptReference("DashboardClient.js")); }
Please find the updated sample on GitHub.
If you have any questions, please let me know!
Best,
Levie
Hi Levie.
It worked perfectly. Thanks so much.
Just out of my ignorance, what do we need the JSZip library for?
Cheers.
Ivan
Please login first to submit.