0

CrystalReportViewerを使用してASP.NETサイトをセットアップしています。ユーザーがレポートを開くと、パラメータープロンプトが表示されます。レポートで問題が発生した場合、パラメータプロンプトに閉じるオプションはなく、エスケープするように見える唯一の方法は、ブラウザの戻るボタンを使用してバックアウトすることです。

他の理由で、このサイトのユーザーは戻るボタンを使用しないように指示されているため、これは機能しません(この指示は私の制御が及ばない)。パラメータープロンプトがページ上の他のリンクをブロックするため、ユーザーは使用できません。クリックして終了します。プロンプトの閉じるボタンをオンにするにはどうすればよいですか?

4

2 に答える 2

2

誰かがまだ解決策を必要としている場合のために、これは私が以前にSAPフォーラムで書いた、はるかに単純でページに何も挿入しない別のものです。閉じるボタンは実際にはすでに存在し、単に非表示になっています。

http://scn.sap.com/message/14895166#14895166

$(document).readyからこの関数を呼び出します。パラメータボックスの[閉じる]ボタンが表示に設定されるまで、1/3秒ごとに自動的にトリガーされます。その後、実行を停止します。Chromeの「オブジェクトの検査」機能を使用して、このdivとそのクラスを見つけました。

幸運を。

window.$my = {    
     dlgCloseBtn: $('div.dlgCloseBtn')    
};

$(document).ready(function() {    
     enableDlgCloseBtn();    
});

/*
** Loops every third of a second until the parameter box's Close button can be made visible.
*/
function enableDlgCloseBtn() {
     if ($my.dlgCloseBtn.css('visibility') === undefined) {
          $my.dlgCloseBtn = $('div.dlgCloseBtn');

     } else if ($my.dlgCloseBtn.css('visibility') !== 'visible') {
          $my.dlgCloseBtn.css('visibility', 'visible');
          return;
     }

     window.setTimeout(enableDlgCloseBtn, 333);
}
于 2015-05-28T05:15:21.200 に答える
1

わかりました。この機能は、設計上、Web用のCrystalReportViewerには存在しないようです。これを回避するために、パラメータプロンプトに自家製の「終了」ボタンを挿入するJavascriptを自分のページに作成しました。

// Forces an exit button into the parameter prompt
function addExitButton() {
    // "ReportViewer" is the name of my CRV, replace with yours
    // Also, you will probably need to adjust the path to the button image URLs
    var okButton = document.getElementById('ReportViewer_submitButton');
    if (okButton != null) {
        var exitLink = '<<URL you want the Exit button to link to here>>';
        var row = okButton.parentNode.parentNode.parentNode;
        if (row != null) {
            var spacer = document.createElement("td");
            spacer.innerHTML = '&nbsp;';
            row.appendChild(spacer);
            var startCell = document.createElement("td");
            startCell.innerHTML = '<img src="../crystalreportviewers13/prompting/images/button_left_normal.gif" />';
            row.appendChild(startCell);
            var cell = document.createElement("td");
            cell.setAttribute("class", "pePromptButton");
            cell.setAttribute("background", "../crystalreportviewers13/prompting/images/button_middle_normal.gif");
            cell.innerHTML = '<div class="pePromptButton"><a href="' + exitLink + '" title="Exit">&nbsp;&nbsp;&nbsp;Exit&nbsp;&nbsp;&nbsp;</a></div>';
            row.appendChild(cell);
            var endCell = document.createElement("td");
            endCell.innerHTML = '<img src="../crystalreportviewers13/prompting/images/button_right_normal.gif" />';
            row.appendChild(endCell);
        }
    }
    else
        setTimeout(addExitButton, 10);
}
addExitButton();

これはテスト済みで、正常に機能しているようです。

于 2012-05-17T22:21:22.917 に答える