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

Is Parameters Area Visible HTML5 ReportViewer

3 Answers 107 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 02 Feb 2016, 05:46 PM

How can I determine if the Parameters Area is visible on the HTML5 ReportViewer using javascript?

I know how to toggle it but I need to check if it is visible first before toggling.

3 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 04 Feb 2016, 11:28 AM
Hello Justin,

The HTML5 Report Viewer exposes all its available commands through the commands collection.
Each command is an object, with the exec() method being the one that actually triggers the command. The other two methods, enabled() and checked() return a bool value and can be used prior to executing a command or to find in what state the UI for the command should be.
The toggleParametersArea shows or hides the parameters area and can be used in the described scenario to check if the parameter area is already enabled or not:
var reportViewer = $("#reportViewer1").data("telerik_ReportViewer");
  
if (reportViewer.commands.toggleParametersArea.checked()) {
    reportViewer.commands.toggleParametersArea.exec();
}

 Regards,
Nasko
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
Binod
Top achievements
Rank 1
commented on 11 Jan 2022, 10:12 AM | edited

 

 

In TRDP report ,toggle parameter area is always  disable .how it  will enable  

I am using telerikReportViewer.js

How it will fixe....any idea??

 

0
Justin
Top achievements
Rank 1
answered on 15 Feb 2016, 11:53 PM

I found .hasClass on the ParametersArea div to be a more reliable way of checking.  I kept getting inconsistent results back with the .checked() on the command object.           

$("#reportViewer1")
    .telerik_ReportViewer({
        serviceUrl: "/api/reports/",
         
        viewMode: "INTERACTIVE",
        scaleMode: "SPECIFIC",
        reportSource: {
            report: reportClass,
            parameters: {
                CultureID: "en"
            }
        },
        renderingEnd: function () {
            if($("div[data-role$='_ParametersArea']").hasClass("hidden"))
                this.commands.toggleParametersArea.exec();
        }
    });
0
Gabriel
Top achievements
Rank 2
answered on 13 Apr 2021, 11:57 AM

Hopefully this will help somebody when trying to hide / show the parameters area of a report. This is working when you're using a model

 $(document).ready(function() {
        $("#webReportViewer").telerik_ReportViewer({
            serviceUrl: "/api/report",
            viewMode: "INTERACTIVE",
            scaleMode: "SPECIFIC",
            reportSource: {
                report: "@Model.ReportType@Model.ReportName\.trdp",
                parameters: {
                    FromDate: @Model.FromDate,
                    ToDate: @Model.ToDate,
                    Extension: @Model.Extension,
                    TalkTime: @Model.TalkTime
                }
            },
            renderingEnd: function() {
                if (!$("div[data-role$='telerik_ReportViewer_ParametersArea']").hasClass("k-state-collapsed")) {
                    this.commands.toggleParametersArea.exec();
                }
            }
        });

Tags
General Discussions
Asked by
Justin
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Justin
Top achievements
Rank 1
Gabriel
Top achievements
Rank 2
Share this question
or