Hide document map on Native Blazor Reportviewer

2 Answers 122 Views
Events Programming Report Viewer - Blazor
Ahmad Josef
Top achievements
Rank 1
Ahmad Josef asked on 11 Jan 2023, 10:31 AM | edited on 18 Jan 2023, 02:49 PM

Hi,

We want to upgrade from blazor reportviewer to Native Blazor Reportviewer, and so far the upgrade has ran smoothly.

However, we are still challenged on how to hide the document map that is toggled on automatically by default. 

First, we tried to hide the document with the following code:

<ReportViewer @ref=... 
            ServiceType=...
            ServiceUrl=...
            ReportSource=...
            DocumentMapVisible="false" --> Should this not hide document map when opening report?
            ParametersAreaVisible=...
            ViewMode=...
            ScaleMode=...          
            />

Unfortunately this did not work, but maybe there is another simple way of hiding the document map? 

Additionally, we have looked into another approach, where we have added a JS function to programmatically hide the button by clicking on the document map button on the reportviewer toolbar:

function reportViewerMapClick() {
    $(".k-i-dictionary-add").click();
}

We have tested the JS function above on a button, where it works:

<button OnClick="reportViewerMapClick()" type="button"> Hide Document Map </button>

But for this to truly work, we need to use this JS function on an event of some sort.

My question is therefore: Are there any simple and easy way of hiding the document map, when opening a report. And if not, are there any events available for when a report has finished loaded? 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 23 Jan 2023, 12:04 PM

Hi Ahmad,

Since the native Blazor Report Viewer does not yet expose its events, there is no way to catch exactly when the rendering of the document will finish. Thus, we have to use an alternative solution in the meantime.

I suggest creating a boolean report parameter that will be used in the DocumentMapText properties of the report items to set the text when the parameter is true and return an empty string or Null when the parameter is false. For example:

This way, we only need to set the value of that parameter to false in the initialization code of the report viewer and there will be no document map text, for example:

    public ReportSourceOptions ReportSource { get; set; } = new ReportSourceOptions("DummyReport.trdx", new Dictionary<string, object>
    {
        { "IncludeMap", false }
    });
<ReportViewer @ref=rv1 ServiceUrl="/api/reports"
    @bind-ReportSource="@ReportSource"
... ></ReportViewer>

We plan to fix the DocumentMapVisible property for the next service pack but until then, this approach should get the job done.

Please let me know if you have any other questions.

Regards,
Dimitar
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
0
Dimitar
Telerik team
answered on 16 Jan 2023, 09:35 AM

Hi Ahmad,

Thank you for the provided information!

The DocumentMapVisible property of the report viewer should definitely hide the document map, I cannot imagine the reason why it did not work on your end. Are you sure that it is indeed the document map that is displayed and not the Parameters Area?

If you are not on the latest release - Telerik Reporting - Progress® Telerik® Reporting R3 2022 SP1 (16.2.22.1109), please test upgrading and see if that resolves the issue.

In case the issue persists even with the latest release, you may try to bind that property of the report viewer, for example:

@page "/"

<PageTitle>Report Viewer</PageTitle>

<ReportViewer
    ServiceType="@ReportViewerServiceType.REST"
    ServiceUrl="https://demos.telerik.com/reporting/api/reports"
    @bind-DocumentMapVisible="@DocumentMapVisible">
</ReportViewer>

@code {
    public bool DocumentMapVisible { get; set; }
}

In case even that does not help, please send me a sample project where the issue is reproduced and we will have a look at it locally.

Regards,
Dimitar
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Ahmad Josef
Top achievements
Rank 1
commented on 16 Jan 2023, 12:45 PM | edited

Unfortunately, we have already tried that, but without success. When we bind the document map property, it results in the report to enter an absurd loop, where it seems like the reportviewer refreshes constantly. 

<ReportViewer @ref=... ServiceType=... ServiceUrl=... ReportSource=... @bind-DocumentMapVisible="@DocumentMapVisible" ViewMode=... ScaleMode=...> </ReportViewer>

           @code {
           public bool DocumentMapVisible { get; set; }
           }

 

We are certain that it is document map that is displayed, but we have tried to set both property to false. We have attached a screenshot of the reportviewer, where we have highlighted the button that needs to be toggled off.

In regards to NuGet packages installed, we have the latest stable release installed on our packages, which are:

  • Telerik.ReportViewer.BlazorNative (16.2.22.1109)
  • Telerik.Reporting.OpenXmlRendering (16.2.22.1109)
  • Telerik.Reporting.Services.AspNetCore (16.2.22.1109)
  • Telerik.ReportViewer.Blazor (16.2.22.1109): This is used on other components of our toolbox, and has not been changed, since we want the Blazor Native to work on a single component, before we change the whole toolbox.
  • Telerik.UI.For.Blazor (3.7.0)

We will in short time make a short sample project, where you can look at it locally.

Thank you for your time and help. It is appreciated 

 

Ahmad Josef
Top achievements
Rank 1
commented on 17 Jan 2023, 09:06 AM

Hi Dimitar,

Upon agreement, we will attach a sample project to this message. Furthermore, we will  attach a screen recording of the error.

Best regards

Josef

Dimitar
Telerik team
commented on 18 Jan 2023, 02:39 PM

Hello Josef,

Thank you for the attached files!

I was able to reproduce the issue with this example and after speaking with the Development team on this, we have decided to log this as a bug on our feedback portal - The DocumentMapVisible/ParametersAreaVisible values set during the initialization of the viewer are not respected (telerik.com).

As a reward for discovering and reporting this issue, we have updated your account's Telerik points.

Currently, the only workaround is to click on the toolbar button after the component is initialized. It can also be done with vanilla JS if you do not want to load jQuery unnecessarily:

document.querySelector(".k-i-dictionary-add").parentElement.click() 

 

Tags
Events Programming Report Viewer - Blazor
Asked by
Ahmad Josef
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or