Asp.net MVC4中的SSR和交互式排序工作

Asp.net MVC4中的SSR和交互式排序工作,asp.net,asp.net-mvc-4,reporting-services,ssrs-2008,Asp.net,Asp.net Mvc 4,Reporting Services,Ssrs 2008,我使用html呈现在mvc中实现了一个报告引擎。我必须根据通过render方法返回的元数据创建自定义分页功能。我现在正在考虑以同样的方式实现交互式排序,这看起来是一项更艰巨的任务。似乎在HTML呈现的HTML设备信息设置标题中有一个名为ActionScript的设置 动作脚本(*)- 指定发生操作事件(例如钻取或书签单击)时要使用的JavaScript函数的名称。如果指定了此参数,则操作事件将触发命名的JavaScript函数,而不是回发到服务器 我的问题是有人使用过这个功能吗?由于在呈现报告后

我使用html呈现在mvc中实现了一个报告引擎。我必须根据通过render方法返回的元数据创建自定义分页功能。我现在正在考虑以同样的方式实现交互式排序,这看起来是一项更艰巨的任务。似乎在HTML呈现的HTML设备信息设置标题中有一个名为ActionScript的设置

动作脚本(*)- 指定发生操作事件(例如钻取或书签单击)时要使用的JavaScript函数的名称。如果指定了此参数,则操作事件将触发命名的JavaScript函数,而不是回发到服务器

我的问题是有人使用过这个功能吗?由于在呈现报告后我丢失了身份验证,因此我必须以某种方式在控制器中进行身份验证回调。在我看来,在报告中添加排序参数可能更容易,但是我希望在报告中保留交互式排序

--编辑解决方案1---

事实证明,上面脚本名称旁边的*表示ActionScript参数在ssrs 2012之后被折旧。因此,我决定不去追求它。如果其他人偶然发现了这一点,那么我想到的模拟交互式排序而不使用回发的最佳方法如下所示:

在报告上

1. Add a parameter to the report SortField1
2. Add a Sort condition to the Tablix or group you wish to sort. Tablix-Sort Expressions
3. Set the expression of the sort to Fields(Paremeters!SortField1.Value).Value
4. Set the default value of parameter SortField1 to the default sort field
5. Set Allow Nulls of the parameter to true.
6. Add a image or label for each column you would like to sort by
7. Create a action for the element created in step 7 with code similar to
  ="javascript:void(reportSortRequest('ColumsFieldName'))"
 NOTE: Your view or view descendant will have need to have an identical function defined to accept the action 
视图中的

  • 实现函数reportSortRequest(fieldName)。这件事应该解决 Model.SortField1并调用回控制器的post以 重新提交报告
  • 在控制器中(这是用于发送具有字段SortField1的模型的Ajax回发)

  • 使用包括SortField1的报告信息调用呈现
  • 更新了用于访问报表标记包装器的客户端脚本。

    ssrs标记生成的报告元素可以通过其标记在视图中访问。我发现,使用预先确定的ssrs包装元素#oReportCell“,以下内容将起作用:

    在iframe中加载:

    var frameContent = $("#myIFrame").contents();        
    var ssrsContentElement = frameContent.find("#oReportCell");
    
    加载到div中:

    var ssrsContentElement = $("#myDiv").find("#oReportCell");
    
    函数将html blob加载到框架或div中。根据报表的配置方式,内容可以是临时文件的url或html标记

    function setReportContent(content, isUrl, renderInIFrame) {        
        if (isUrl) {
            if (renderInIFrame) {
                $("#reportContent").html("<iframe id='reportFrame' sandbox='allow-same-origin allow-scripts' width='100%' height='300' scrolling='yes' onload='onReportFrameLoad();'\></iframe>");
                $('#reportFrame').attr('src', content);               
            }
            else 
                $("#reportContent").load(content);              
    
        }
        else {
            if (renderInIFrame) {
                $("#reportContent").html("<iframe id='reportFrame' sandbox='allow-same-origin allow-scripts' width='100%' height='300' scrolling='yes' onload='onReportFrameLoad();'\></iframe>");               
                $('#reportFrame').contents().find('html').html(content);
            }
            else      
                $("#reportContent").html(content);            
        }
        if(!renderInIFrame)
            showReportWaitIndicator(false);
        $("#reportContent").show();
    }
    
    函数setReportContent(content,isUrl,renderInIFrame){
    如果(isUrl){
    如果(RenderInFrame){
    $(“#reportContent”).html(“”);
    $('#reportFrame').attr('src',content);
    }
    其他的
    $(“#报告内容”)。加载(内容);
    }
    否则{
    如果(RenderInFrame){
    $(“#reportContent”).html(“”);
    $('#reportFrame').contents().find('html').html(content);
    }
    其他的
    $(“#reportContent”).html(内容);
    }
    如果(!RenderInFrame)
    showReportWaitIndicator(假);
    $(“#reportContent”).show();
    }
    

    请注意,如果希望正确呈现设置了自动调整大小属性的报表图像,则必须启用
    允许脚本
    ,以便启动ssrs resize js函数,请小心。

    如何添加“javascript:void(reportSortRequest('ColumsFieldName'))“to table header?通过SSRS.Label.Action.Url=link您可能会考虑创建一个更复杂的设置,在这个设置中,由于我没有时间,header将发送一个SortUp | SortDown | SortNone:(我无法在href标记中传递当前元素)您有任何替代(“javascript:void(reportSortRequest(this))”)吗?当前元素是什么意思?