StiViewerMvc parameters

Stimulsoft Reports.WEB discussion
Post Reply
pritaeas
Posts: 7
Joined: Mon Apr 07, 2014 7:33 am

StiViewerMvc parameters

Post by pritaeas »

HI. Just need a push in the right direction. If I make a report with a parameters panel for MVC, does (re)setting these call the controller's ReportSnapshot method again? If so, how can I access the user values in my controller method to return the right data?

For a completer picture, assume a report defaulting to a date range of a month, but having the ability to change those at will.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: StiViewerMvc parameters

Post by HighAley »

Hello.

You could use next code in Interaction action to get values of parameters.

Code: Select all

public ActionResult InteractionEvent()
        {
            StiJavascriptParameters parameters = StiMvcViewer.GetViewerParameters();
            var value = ((System.Collections.Hashtable)parameters.Parameters["variables"])["Variable1"];
            return StiMvcViewer.InteractionResult();        
        }
Thank you.
pritaeas
Posts: 7
Joined: Mon Apr 07, 2014 7:33 am

Re: StiViewerMvc parameters

Post by pritaeas »

OK, that's how I get the parameters, but how am I passing back the new/changed dataset?

All the examples I can find pass in all data, then filter. I want to pass in only the relevant data, and reload when the filters change.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: StiViewerMvc parameters

Post by HighAley »

Hello.

Here is code that change the value of variable when the Request from user parameters are passed.
You could register new data the same way here.

Code: Select all

        public ActionResult InteractionEvent()
        {
            var par = StiMvcViewer.GetViewerParameters();
            //par.Action
            StiReport report = StiMvcViewer.GetReportObject();
            report["Variable1"] = "жопа";
            report.Render();
            return StiMvcViewer.InteractionResult(report);
        }
Thank you.
Post Reply