cabrillo.modal - クライアント

  • リリースバージョン: Zurich
  • 更新日 2025年07月31日
  • 所要時間:3分
  • Cabrillo JS ネイティブモーダルの内部に Web コンテンツを表示するための関数

    cabrillo.modal - dismissModal(オブジェクトデータ)

    presentModal() 関数で提示されたモーダルを閉じるために使用します。

    提示されたモーダルは、それ自体を却下し、結果を提示コンテキストに返す役割を担います。dismissModal() 関数は、提示するコンテキストからではなく、提示するコンテキストから呼び出す必要があります。

    表 : 1. パラメーター
    名前 タイプ 説明
    data オブジェクト オプション。提示されたコンテキストがそれ自体を却下したときに、提示するコンテキストに返すオブジェクト。
    表 : 2. 戻り値
    タイプ 説明
    promise 成功した場合は未解決のオブジェクト、それ以外の場合はエラー。
    // Any object can be passed back to the presenting context when the presented context dismisses itself.
    var results = {
        team: 'Mobile'
        company: 'ServiceNow'
    }
    
    cabrillo.modal.dismissModal(results).then(function() {
        console.log('Modal was dismissed and results were passed to presenting context.');
    }, function(error) {
        console.log(error);
    });

    cabrillo.modal presentModal( 文字列 title, 文字列 url, 文字列 closeButtonStyle, 文字列 modalPresentationStyle)

    ネイティブ モーダル インターフェイスでコンテンツを表示します。

    表 : 3. パラメーター
    名前 タイプ 説明
    title 文字列 モーダル インターフェイスのタイトル
    url 文字列 モーダルを開くための URL。これは内部インスタンス URL (完全修飾または相対、相対 URL が優先) である必要があります。
    closeButtonStyle 文字列 モーダルインターフェイスの [閉じる] ボタンスタイル。
    可能な値:
    • cabrillo.modal.CLOSE_BUTTON_STYLE_CANCEL
    • cabrillo.modal.CLOSE_BUTTON_STYLE_CLOSE
    • cabrillo.modal.CLOSE_BUTTON_STYLE_DONE
    詳細については、「Cabrillo JS 定数 - 閉じるボタンのスタイル」を参照してください。
    modalPresentationStyle 文字列 モーダルインターフェイスのプレゼンテーションスタイル。
    可能な値:
    • cabrillo.modal.MODAL_PRESENTATION_STYLE_FULL_SCREEN
    • cabrillo.modal.MODAL_PRESENTATION_STYLE_FORM_SHEET
    詳細については、「Cabrillo JS 定数 - モーダルプレゼンテーションスタイル」を参照してください。
    注:
    このパラメーターは Apple iOS でのみサポートされています。
    表 : 4. 戻り値
    タイプ 説明
    promise 成功した場合は Cabrillo.ModalResponse オブジェクト、それ以外の場合はエラー。

    カスタム URL を読み込むネイティブ モーダルを表示します。これにより、フォーム シート スタイルのモーダルにカスタムのサービスポータルページが表示されます。モーダルが却下されたとき、約束が実行されます。カスタムの却下機能については、「dismissModal() 関数」を参照してください。

    cabrillo.modal.presentModal('Portal Page',
        '/$sp.do?id=my_modal_page',
        cabrillo.modal.CLOSE_BUTTON_STYLE_CLOSE,
        cabrillo.modal.MODAL_PRESENTATION_STYLE_FORM_SHEET
    ).then(function(response) {
        // The results from the modal are in a results key on the response object.
        var results = response && response.results ? response.results : null;
    
        if (results) {
            console.log('Modal dismissed with results.', results);
        } else {
            console.log('Modal dismissed without results.');
        }
    }, function(error) {
        console.log(error);
    });