need to refresh html viewer
Posted: Mon Sep 14, 2020 6:49 am
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();
}
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();
}