need to refresh html viewer

Stimulsoft Dashboards.WEB discussion
Post Reply
Diaco2020
Posts: 4
Joined: Mon Sep 14, 2020 6:36 am

need to refresh html viewer

Post by Diaco2020 »

hello all.
I have one project for showing dashboard in mvc and need to refresh html viewer after drop down list changed.
how can i Do this in controller or view?
this is my index view:
@Scripts.Render("~/bundles/jquery")
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js"> </script>
@using Stimulsoft.Report.Mvc;

@{
ViewData["Title"] = "Index";
}
<h2>Show Dashboard in the Viewer</h2>


<script src="https://ajax.googleapis.com/ajax/libs/j ... "></script>
<select id="maptype" onchange="maptypePostback()" title="">
<option value="1">Individual</option>
<option value="2">Group</option>
<option value="3">Heatmap</option>
<option value="4">HeatmapWithGroup</option>
</select>
<input type="submit" value="Submit" />



@Html.Stimulsoft().StiMvcViewer(new StiMvcViewerOptions()
{
Actions =
{
GetReport = "GetReport2",
ViewerEvent = "ViewerEvent",
//PreviewReport = "PreviewReport",
//SaveReport = "SaveReport",
//DesignerEvent = "DesignerEvent"
//DesignReport = "DesignReport"
}

})

@Html.Stimulsoft().StiMvcViewer(new StiMvcViewerOptions()
{
Actions =
{
GetReport = "GetReport1",
ViewerEvent = "ViewerEvent",

//PreviewReport = "PreviewReport",
//SaveReport = "SaveReport",
//DesignerEvent = "DesignerEvent"
//DesignReport = "DesignReport"
}

})

@*<script>
function maptypePostback()
{
$('#maptype').on('change', function () {
var ID = $('#maptype').val();
});
$('#maptype').submit();
}
</script>*@
<script>
function maptypePostback() {
debugger;


$.ajax({
url: '@Url.Action("GetReport2", "Viewer")',
type: 'POST',
data: { type: $('#maptype').val() },
success: function () {

@*$.ajax({
url: '@Url.Action("ViewerEvent", "Viewer")',
type: 'POST',
success: function () {

},
error: function (e) {
console.log(e)
alert("error");
}
});*@
},
error: function (e) {
console.log(e)
alert("error");
}
});
return false;
}

</script>

this is my viewer controller:

public ActionResult GetReport1()
{
// Create the dashboard object
var report1 = StiReport.CreateNewDashboard();

// Load dashboard template
report1.Load(Server.MapPath("~/Dashboards/Report1.mrt"));

// Return template to the Viewer
return StiMvcViewer.GetReportResult(report1);

}
public ActionResult GetReport2(short? type=1)
{


var returnreport = StiReport.CreateNewDashboard();


switch (type)
{
// Load report snapshot
case 1:
{
// Load dashboard template

returnreport.Load(Server.MapPath("~/Dashboards/MapWithParameter2.mrt"));

break;

}

// Load report template
case 4:
{
// Load dashboard template

returnreport.Load(Server.MapPath("~/Dashboards/MapWithParameter.mrt"));

break;
}
}


// Return template to the Viewer
return StiMvcViewer.GetReportResult(returnreport);

}

public ActionResult ViewerEvent()
{
return StiMvcViewer.ViewerEventResult();


}
Diaco2020
Posts: 4
Joined: Mon Sep 14, 2020 6:36 am

Re: need to refresh html viewer

Post by Diaco2020 »

I also need that after change drop down list value MapWithParameter is shown in viewer.
thanks.
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: need to refresh html viewer

Post by HighAley »

Hello

Please, send us this project to support@stimulsfot.com.
We need to reproduce the issue to help you.

Thank you.
Lech Kulikowski
Posts: 6265
Joined: Tue Mar 20, 2018 5:34 am

Re: need to refresh html viewer

Post by Lech Kulikowski »

Hello,

You can call submit button action.
//where jsStiWebViewer1 - "js" + Viewer ID
jsStiWebViewer1.postAction("Submit");

Thank you.
Diaco2020
Posts: 4
Joined: Mon Sep 14, 2020 6:36 am

Re: need to refresh html viewer

Post by Diaco2020 »

thanks mr Lech Kulikowski for your reply.
my viewer refreshed by this code.
now I have another problem with showing my dashboard named MapWithParameter when the selected value for drop down list is changed,viewer shows dashboard named MapWithParameter2 again.
what is the problem in my code?
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: need to refresh html viewer

Post by HighAley »

Hello

Please, send us this project to support@stimulsfot.com.
We need to reproduce the issue to help you.

Thank you.
Post Reply