Obtaining report parameters client side

3 posts, 1 answers
  1. krisdoff
    krisdoff avatar
    15 posts
    Member since:
    Nov 2006

    Posted 20 Feb 2018 Link to this post

    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. Answer
    Todor
    Admin
    Todor avatar
    384 posts

    Posted 22 Feb 2018 Link to this post

    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
  3. krisdoff
    krisdoff avatar
    15 posts
    Member since:
    Nov 2006

    Posted 23 Feb 2018 in reply to Todor Link to this post

    Ok, great thanks for that
Back to Top