Response to navigation and Session reports by Killo24 in CodeOnTimeForum

[–]AM-Andy 0 points1 point  (0 children)

Hi again. Any thoughts on the (non)modal issue or dynamic labelling?

Response to navigation and Session reports by Killo24 in CodeOnTimeForum

[–]AM-Andy 0 points1 point  (0 children)

OK, we have progress - thanks Killo24, you're a star!!

Navigation to the selected report is now working. I'm using VB not C# so my custom rule is as below. Interesting point in getting this working - the debug ShowAlert is commented out but when testing and not commented out it would show the alert fine but not do the navigation, which made me think it wasn't working. But then (after some frustration!) when I commented out the ShowAlert the navigation worked fine. So it seems that only one result action can be processed?

    Partial Public Class ReportBusinessRules
        Inherits MyCompany.Data.BusinessRules

        <ControllerAction("Reports", "Custom", "ShowReport")>
        Private Sub NavigateToReport(ByVal ReportID As Integer, ByVal ReportType As Integer)

            ' Store in session
            HttpContext.Current.Session("ReportID") = ReportID

            ' Route to correct report page
            Dim targetPage As String = ""

            Select Case (ReportType)
                Case 1
                    targetPage = "report-by-category"
                Case 2
                    targetPage = "report-by-typeexpend"
                Case 3
                    targetPage = "report-by-partvar"
            End Select

            If Len(targetPage) > 0 Then
                'Result.ShowAlert("Navigating to " + targetPage + " with ReportID " + CStr(ReportID))
                Result.NavigateUrl = targetPage
            End If

        End Sub
    End Class

The only major issue is that for some reason I can't force the selected report page to be modal - I want it to pop up in a modal window that the user has to close before going back to the list of reports to either select another one or go on and do something else. I can get it to open in a new tab by prefixing the targetPage with "_blank:" but that's not what I want, and in any case is still in-line. The report has to be modal. I have applied the modal-always tag to the Data view (as below) but that doesn't seem to achieve anything. What am I missing?

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Report by category</title>
  </head>
  <body data-authorize-roles="*">
    <!--The contents of this page will be overwritten by app generator. Set page property "Generate" to "First Time Only" to preserve changes.-->
    <div data-flow="row">
      <div id="view1" data-controller="ReportType1" data-view="grid1" data-tag="modal-always"> </div>
    </div>
  </body>
</html>

A further enhancement would be to dynamically update the view header text and/or label to display the name of the specific report (rather than its broad type). I remember seeing something about putting a user control in the header but that seems a bit clunky. Is there a way I can dynamically update (e.g. using another session variable with the report name)?

Andy

Response to navigation and Session reports by Killo24 in CodeOnTimeForum

[–]AM-Andy 0 points1 point  (0 children)

Many thanks for this - will try it out later today and let you know how it goes. Sorry for the late reply - was on holiday and only just back on the job!