This is a migrated thread and some comments may be shown as answers.

Obtaining report parameters client side

2 Answers 210 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
krisdoff
Top achievements
Rank 1
krisdoff asked on 20 Feb 2018, 02:48 PM

Hi, I am sure I am missing the obvious but...

 

Is there a way to obtain the current parameter values from a reportViewer on the client (html) side?

I have a report viewer that works along side a menu that offers several reports that are fundamentally related and all share the same parameters.  When the user makes a change (for example the date range), and then chooses one of the other reports, I want to ensure the same date range is pre-selected.

Is this possible? or do I have to supply my own parameter controls and steal the values from that, seems a lot of work in comparison to just having access to a collection of current parameter values, something like ..

 

var viewer = $("#reportViewer1").data("telerik_ReportViewer");
var currentParams = viewer.reportSource.parameters;

viewer.reportSource( { 

                                report: reportDefinition
                                , parameters: currentParams
                            });

Many thanks

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Todor
Telerik team
answered on 22 Feb 2018, 10:35 AM
Hello krisdoff,

You can get the parameters already assigned to the client reportSource by calling reportSource() that will return an object with properties 'report' and 'parameters'.
The code would rather look like:
var viewer = $("#reportViewer1").data("telerik_ReportViewer");
var currentParams = viewer.reportSource().parameters;

Check this article for details.

Note that reportSource(rs) (i.e. the same function with an argument) would assign new values to the client reportSource.

Regards,
Todor
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
krisdoff
Top achievements
Rank 1
answered on 23 Feb 2018, 03:21 PM
Ok, great thanks for that
Tags
General Discussions
Asked by
krisdoff
Top achievements
Rank 1
Answers by
Todor
Telerik team
krisdoff
Top achievements
Rank 1
Share this question
or