GlideModal - 클라이언트

  • 릴리스 버전: Yokohama
  • 업데이트 날짜 2025년 01월 30일
  • 읽기31분
  • GlideModal API는 모달이라고 하는 컨텐츠 오버레이를 표시하는 메서드를 제공합니다. 모달은 페이지 위에 표시되며 사용자가 작업을 수행하면 닫히는 대화형 창입니다. 모달을 사용하여 정보를 표시하거나, 질문을 하거나, 작업을 수행할 수 있습니다.

    클라이언트 측 JavaScript를 사용할 수 있는 모든 위치에서 스크립트에 GlideModal 메서드를 사용합니다. 이러한 메서드는 클라이언트 확인란이 선택된 UI 작업에서 가장 자주 호출됩니다.

    GlideModal API를 사용하여 사용자 지정 모달을 만들거나 기존 기본 시스템 모달을 활용할 수 있습니다.

    주:
    이는 GlideWindowGlideDialogWindow API를 대체하는 모든 기능을 제공합니다.

    GlassModal은 작업 공간에서 작동하지 않으며 대신 g_modal API를 사용합니다.

    그림 1. 예제 모달
    오버레이 예시
    모달에는 다음과 같은 다양한 유형의 컨텐츠가 포함될 수 있습니다.
    • 정적 텍스트
    • 동적 텍스트
    • 양식
    • 이미지
    • 단추
    이 API를 사용하여 다음을 수행할 수 있습니다.
    • glide_confirm, glide_info 또는 glide_alert와 같은 기본 시스템 모달을 검색합니다.
    • UI 페이지 또는 전달된 HTML에서 모달 컨텐츠를 작성합니다.
    • 모달에서 제목을 설정합니다.
    • 모달의 본문 내용을 설정합니다.
    • 모달의 너비를 설정합니다.
    • 기본 설정을 얻고 구성합니다.
    • 모달 뷰를 전환합니다.
    UI에 모달을 표시하려면 렌더링 메서드 중 하나를 호출해야 합니다.
    다음 코드 예제에서는 UI 페이지 "my_modal"를 사용하여 모달을 만들고 렌더링하는 방법을 보여 줍니다.
    var dialog = new GlideModal("my_modal");
    
    //Set the dialog title
    dialog.setTitle('Show title');
    
    //Set the dialog width		      	
    dialog.setWidth(550);
    
    //Display the modal
    dialog.render();

    이 코드 예제에서는 renderWithContent() 메서드와 HTML을 사용하여 모달의 내용을 정의하여 모달을 만들고 렌더링하는 방법을 보여 줍니다.

    function cancelDialog(){
    
      var dialog = new GlideModal('cancelTask');
      //Sets the dialog title
      dialog.setTitle('Cancel Task');
      //Set up valid custom HTML to display
      dialog.renderWithContent('<div style="padding:15px"><p>What action do you want to take?</p>
        <p><select name="cancellation" id="taskCancellation" class="form-control">
        <option value="cancelOnly" role="option">Cancel this task but keep the requested item open</option>
        <option value="cancelAll" role="option">Cancel this and all other tasks, closing the requested item</option>
        </select></p><div style="padding:5px;float:right"><button style="padding:5px;margin-right:10px"      onclick="window.changeTaskAction(this.innerHTML,jQuery(\'#taskCancellation\').val())"      class="btn btn-default">Abort</button><button style="padding:5px" class="btn btn-primary"      onclick="window.changeTaskAction(this.innerHTML,jQuery(\'#taskCancellation\').val())">Cancel Task</button></div></div>');
    
      //Use the windows object to ensure the code is accessible from the modal dialog
      window.changeTaskAction = function(thisButton, thisAction){
    
        //Close the GlideModal dialog window
        dialog.destroy();
    
        //Submit to the back-end
        if(thisButton=='Cancel Task'){
          if(thisAction=="cancelAll"){
            g_form.setValue('state',4); //Closed Incomplete -- will close the Requested Item and all other open tasks
          }else{
            g_form.setValue('state',7); //Closed Skipped -- will only close this task
          }
             //Regular ServiceNow form submission
             gsftSubmit(null, g_form.getFormElement(), 'cancel_sc_task');
          }
       };
       return false; //Prevents the form from submitting when the dialog first load
    }

    기본 시스템 모달

    기본 ServiceNow 인스턴스는 GlideModal을 사용하여 모달을 표시할 때 사용할 수 있는 UI 페이지로 정의된 다음 모달을 제공합니다.

    • glide_alert_standard: 확인 단추와 정보 또는 경고 아이콘이 있는 경보 모달
      glide_alert_standard 모달
    • glide_ask_standard: 아니요 버튼이 있는 확인 모달
      glide_ask_standard 모달
    • glide_confirm: 저장 안 함, 취소저장 버튼이 있는 확인 모달입니다.
      glide_confirm 모달
    • glide_confirm_basic: 확인취소 단추가 있고 아이콘 없이 확인 모달
      glide_confirm_basic 모달
    • glide_confirm_standard: 확인취소 버튼과 정보 또는 경고 아이콘이 있는 확인 모달
      glide_confirm_standard 모달
    • glide_info: 정보 아이콘과 확인 단추가 있는 정보 모달 모달 창의 너비입니다.
      glide_info 모달
    • glide_progress_standard: 닫기 버튼, 정보 또는 경고 아이콘, 스크롤 진행률 표시줄이 있는 정보 모달 진행률 표시줄은 애니메이션 GIF 이미지이며 일반적인 진행률 표시줄로 업데이트할 수 없습니다.
      glide_progress_standard 모달
    • glide_progress_no_button: 정보 또는 경고 아이콘과 스크롤 진행률 표시줄이 있는 정보 모달입니다. 진행률 표시줄은 애니메이션 GIF 이미지이며 일반적인 진행률 표시줄로 업데이트할 수 없습니다.
      glide_progress_no_button 모달
    • glide_prompt: 프롬프트 텍스트 상자와 확인취소 버튼이 있는 모달
      glide_prompt 모달
    • glide_warn: OK 버튼은 있지만 아이콘은 없는 간단한 모달
      glide_warn 모달

    기본 설정

    모달 기본 설정은 렌더링되는 모달에 데이터를 전달하는 방법을 제공합니다. setPreference() 또는 setPrefAndReload() 메서드를 사용하여 환경 설정 값을 설정합니다. 그런 다음 이 메서드를 사용하여 GlideModal - getPreference(문자열 이름) 설정된 기본 설정을 검색합니다.

    UI 페이지에서 기본 설정을 검색하려면 RP.getWindowProperties().get('preference_name') 함수를 사용합니다.

    일부 기본 시스템 모달은 다음과 같은 시스템 기반 기본 설정을 지원합니다.
    • autoFocus: 모달이 렌더링되면 자동으로 포커스를 받는지 여부를 나타내는 플래그입니다. 모달이 초기화되면 true로 설정합니다.
    • body: 모달의 본문에 전달된 컨텐츠를 설정합니다.
    • buttonClass: 버튼 클래스를 설정합니다.
    • buttonClassCancel: 모달의 취소 버튼에 대한 클래스를 설정합니다.
    • buttonClassComplete: 모달에서 확인 단추(완료)에 대한 클래스를 설정합니다.
    • buttonLabel 버튼 레이블을 설정합니다.
    • buttonLabelCancel: 모달에서 취소 버튼의 레이블을 설정합니다.
    • buttonLabelComplete: 모달에서 확인 단추(완료)의 레이블을 설정합니다.
    • callbackParam: 콜백 매개변수를 설정합니다.
    • focusTrap: 열려 있는 동안 모달 외부의 모든 상호 작용을 차단할지 여부를 나타내는 플래그입니다. 모달이 초기화되면 false로 설정됩니다.
    • modal_title: 모달의 제목을 설정합니다. setTitle() 메서드에서 사용합니다.
    • onPromptCancel: 사용자가 취소 버튼을 선택할 때 호출할 함수를 정의합니다.
      예:
      dialog.setPreference("onPromptCancel", function() {
        return false;
      });
    • onPromptComplete: 사용자가 확인 단추를 선택할 때 호출할 함수를 정의합니다.
      예:
      dialog.setPreference("onPromptComplete", function () {
        gsftSubmit(null, g_form.getFormElement(), 'check_button');
      });

    GlideModal - GlideModal(문자열 ID, 부울 읽기 전용, 숫자/문자열 너비)

    GlideModal 클래스의 인스턴스를 만듭니다.

    표 1. 매개변수
    이름 유형 설명
    ID 문자열 모달에 로드할UI 페이지의 이름입니다.

    다음에서 사용 가능한 UI 페이지 목록을 찾을 수 있습니다. 시스템 UI > UI 페이지

    readOnly 부울 옵션입니다. 모달의 컨텐츠가 읽기 전용인지 여부를 나타내는 플래그입니다.
    유효한 값은 다음과 같습니다.
    • true: 컨텐츠가 읽기 전용입니다.
    • false: 사용자가 컨텐츠를 수정할 수 있습니다.

    기본값: false

    width 숫자 또는 문자열 옵션입니다. 모달의 너비(픽셀 단위) 또는 모달 CSS 클래스입니다. 픽셀 너비가 전달되면 지정된 너비가 해당 CSS 클래스와 정렬됩니다.
    가능한 모달 CSS 클래스:
    • modal-alert : (300px) 지정된 너비가 0에서 349 픽셀 인 경우 할당됩니다.
    • modal-sm: (400픽셀) 지정된 너비가 350에서 449픽셀인 경우 할당됩니다.
    • modal-md: (600픽셀) 지정된 너비가 450에서 649픽셀인 경우 할당됩니다.
    • modal-lg: (900픽셀) 지정된 너비가 650에서 900픽셀인 경우 할당됩니다.

    기본값: modal-md

    최대 너비: 900픽셀

    주:
    방법을 사용하여 모달 너비를 GlideModal - setWidth(숫자/문자열 너비) 설정할 수도 있습니다.

    다음 코드 예제에서는 기존 UI 페이지를 사용하여 GlideModal 개체를 만드는 방법을 보여 줍니다.

    var dialog = new GlideModal('UI_dialog_name');
    
    //Set the dialog title
    dialog.setTitle('Show title'); 
    
    //Set the desired preferences
    dialog.setPreference('table', 'task'); 			
    dialog.setPreference('name', 'value');        	
    
    //Opens the dialog
    dialog.render();

    다음 코드 예제에서는 glide_confirm 파일을 사용하여 GlideModal 객체를 만드는 방법을 보여 줍니다.

    var dialog = new GlideModal('glide_confirm', true, 300);
    dialog.setTitle(new GwtMessage().getMessage('Confirmation'));
    dialog.setPreference('body', new GwtMessage().format("This will complete all update sets in the batch. Continue changing state to complete?"));
    dialog.setPreference('focusTrap', true);
    dialog.setPreference('onPromptComplete', doComplete);
    dialog.setPreference('onPromptCancel', doCancel);
    dialog.render();
    	
    function doComplete() {
      callback(true);
    }
    	
    function doCancel() {
      callback(false);
    }

    GlideModal - destroy()

    현재 모달을 닫습니다.

    표 2. 매개변수
    이름 유형 설명
    없음
    표 3. 반환
    유형 설명
    안 함

    다음 코드 예제에서는 destroy() 메서드를 사용하여 모달을 닫는 방법을 보여 줍니다.

    function cancelDialog(){
    
    var gmod = new GlideModal('cancelTask');
      //Sets the dialog title
      gmod.setTitle('Cancel Task');
      //Set up valid custom HTML to be displayed
      gmod.renderWithContent('<div style="padding:15px"><p>What action do you want to take?</p>
        <p><select name="cancellation" id="taskCancellation" class="form-control">
        <option value="cancelOnly" role="option">Cancel this task but keep the requested item open</option>
        <option value="cancelAll" role="option">Cancel this and all other tasks, closing the requested item</option>
        </select></p><div style="padding:5px;float:right"><button style="padding:5px;margin-right:10px"      onclick="window.changeTaskAction(this.innerHTML,jQuery(\'#taskCancellation\').val())"      class="btn btn-default">Abort</button><button style="padding:5px"      class="btn btn-primary" onclick="window.changeTaskAction(this.innerHTML,jQuery(\'#taskCancellation\').val())">
        Cancel Task</button></div></div>');
    
      //Use the windows object to ensure our code is accessible from the modal dialog
      window.changeTaskAction = function(thisButton, thisAction){
    
        //Close the glide modal dialog window
        gmod.destroy();
    
        //Submit to the back-end
        if(thisButton=='Cancel Task'){
          if(thisAction=="cancelAll"){
            g_form.setValue('state',4); //Closed Incomplete -- closes the Requested Item and all other open tasks
          }else{
            g_form.setValue('state',7); //Closed Skipped -- only closes this task
          }
          //Regular ServiceNow form submission
          gsftSubmit(null, g_form.getFormElement(), 'cancel_sc_task');
        }
      };
      return false; //Prevents the form from submitting when the dialog first load
    }

    다음 코드 예제는 GlideModal.get().destroy() 를 사용하여 모달을 닫는 방법을 보여줍니다.

    // The following button should be declared somewhere in the UI page HTML.
    <button onclick="closeMe()">close</button>
    
    // The following code is in the client script.
    function closeGlideModal() {
      try {
        GlideModal.get().destroy();
      }catch(err){
        console.warn("closeGlideModal ERROR: "+err.message);
        var x = document.getElementById('THE_NAME_OF_YOUR_UI_PAGE' + '_closemodal');
        if (x) {
          x.click();
        } else {
          console.warn("No 'X' close button found!");
        }
      }
    }
    function closeMe() {
      setTimeout(function(){
        closeGlideModal();
      },100);
    }

    GlideModal - get(문자열 id)

    지정된 UI 페이지 이름으로 식별되는 GlideModal 객체를 반환합니다.

    이 메서드를 사용하여 GlideModal.get().destroy()와 같은 다른 GlideModal 작업에 사용할 GlideModal 객체를 가져옵니다.

    표 4. 매개변수
    이름 유형 설명
    ID 문자열 모달과 연결된UI 페이지의 이름입니다.

    기본 인스턴스에서 제공되는 기본 시스템 모달 을 지정할 수도 있습니다.

    다음에서 사용 가능한 UI 페이지 목록을 찾을 수 있습니다. 시스템 UI > UI 페이지.

    표 5. 반환
    유형 설명
    GlideModal 요청된 GlideModal 객체입니다.

    이 예제에서는 get() 메서드를 사용하여 destroy() 메서드를 사용하여 닫으려는 모달을 가져오는 방법을 보여 줍니다.

    // If the modal was initially created like this:
    
    var dialog = new GlideModal("glide_confirm"); 
    dialog.render();
    
    // Some code using the modal
    .
    .
    .
    
    // Now use the get() and destroy() methods to close the modal
    var glideModal = new GlideModal().get("glide_confirm");
    glideModal.destroy();
    
    // You could also code it like this:
    GlideModal.prototype.get("glide_confirm").destroy();

    GlideModal - getPreference(문자열 이름)

    지정된 기본 설정(property)의 값을 반환합니다. 기본 설정을 사용하여 렌더링되는 페이지에 데이터를 전달합니다.

    모달을 생성하는 작업을 호출하면 일반적으로 메서드를 사용하여 GlideModal - setPreference(문자열 이름, 문자열 값) 모달에 필요한 기본 설정도 생성됩니다. 그런 다음 UI 페이지 클라이언트 스크립트는 이 메서드와 RP.getWindowProperties().get('preference_name') 함수를 사용하여 이러한 기본 설정을 사용할 수 있습니다.

    표 6. 매개변수
    이름 유형 설명
    이름 문자열 검색할 기본 설정 값의 이름입니다. 이 값은 메서드를 사용하여 GlideModal - setPreference(문자열 이름, 문자열 값) 모달에서 이전에 설정되었어야 합니다.
    표 7. 반환
    유형 설명
    문자열 지정된 기본 설정 값입니다.

    이 예시에서는 기본 설정을 설정한 후 지정된 모달에서 해당 기본 설정을 검색하는 간단한 경우를 보여줍니다.

    var dialog = new GlideModal('UI_dialog_name');
    // Sets the dialog title
    dialog.setTitle('Modal title');
    
    // Sets the value of the preference table
    dialog.setPreference('table', 'incident');
    
    // Gets the value of the preference table
    var title = dialog.getPreference('table');

    GlideModal - render()

    모달에서 API가 인스턴스화될 때 지정된 UI 페이지를 렌더링합니다. UI에 표시할 모달을 정의한 후 이 메서드를 호출해야 합니다.

    UI 페이지를 사용하여 모달의 컨텐츠를 생성할 때 이 메서드를 호출합니다. 모달 내에 HTML을 표시하려면 또는 GlideModal - renderWithContent(String html) 를 호출하여 GlideModal - renderWithContent(객체 html) 모달을 렌더링합니다.

    표 8. 매개변수
    이름 유형 설명
    없음
    표 9. 반환
    유형 설명
    void

    다음 코드 예제에서는 UI 페이지 glide_confirmglide_info 사용하여 GlideModal 개체를 인스턴스화하고, 다양한 기본 설정을 설정한 다음, UI(렌더링)에 적절한 모달을 표시하는 방법을 보여 줍니다.

    var UpdateSetClient = Class.create({
    
      mergeConfirm: function () {
        var filterCriteriaMsg = "Please select filter criteria matching two or more update sets to merge";
        var messageMap = new GwtMessage().getMessages([filterCriteriaMsg, "Confirmation",
          "Are you sure you want to merge these {0} update sets? You will not be able to undo this action",
          "Invalid selection", "OK", "Cancel"]);
        var list = GlideList2.get('sys_update_set');
        var dialog;
        if (list.totalRows == 0 || list.totalRows == 1) {
          dialog = new GlideModal('glide_info', true, 300);
          dialog.setPreference('focusTrap', true);
          dialog.setTitle(messageMap["Invalid selection"]);
          dialog.setPreference('body', messageMap[filterCriteriaMsg]);
          dialog.setPreference('buttonLabel', messageMap["OK"]);
          dialog.render();
          return;
        }
        dialog = new GlideModal('glide_confirm', true, 300);
        dialog.setTitle(messageMap["Confirmation"]);
        dialog.setPreference('focusTrap', true);
        dialog.setPreference('body', new GwtMessage().format(
          messageMap["Are you sure you want to merge these {0} update sets? You will not be able to undo this action"],
          list.totalRows));
        dialog.setPreference('buttonLabelComplete', messageMap["OK"]);
        dialog.setPreference('onPromptComplete', this.merge);
        dialog.setPreference('buttonLabelCancel', messageMap["Cancel"]);
        dialog.setPreference('onPromptCancel', this.mergeExit);
        dialog.render();
      },
    
      merge: function () {
      var list = GlideList2.get('sys_update_set');
      var query = list.getQuery();
      var name = $('update_set_name').value;
      var comments = $('update_set_comments').value;
    
      var gurl = new GlideAjax('AngularProcessor','angular.do');
      gurl.addParam('sysparm_type', 'hub_client');
      gurl.addParam('type', 'merge_update_sets');
      gurl.addParam('name', name);
      gurl.addParam('comments', comments);
      gurl.addParam('query', query);
      gurl.getXML(function (response) {
          var data = response.responseText.evalJSON();
          var p = data.progress;
          if (p) {
            var progressId = p.progress_id;
            var map = new GwtMessage().getMessages(["Close", "Update Set Merge"]);
            var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
            var dd = new dialogClass("hierarchical_progress_viewer", false, "40em", "10.5em");
            dd.setPreference('focusTrap', true);
            dd.setTitle(map["Update Set Merge"]);
            dd.setPreference('sysparm_renderer_execution_id', progressId);
            dd.setPreference('sysparm_renderer_expanded_levels', '0'); // collapsed root node by default
            dd.setPreference('sysparm_button_close', map["Close"]);
            dd.render();
            //when all trackers are completed
            dd.on("executionComplete", function(trackerObj) {
              if (trackerObj.state == "2") {
                var redirectUrl = new GlideURL('sys_update_set_list.do');
                window.location.replace(redirectUrl.getURL());
                return;
              }
              var closeBtn = $("sysparm_button_close");
              if (closeBtn) {
                closeBtn.onclick = function() {
                  dd.destroy();
                };
              }
            });
          }
        });
      },
    
      mergeExit: function () {
        // Do nothing interesting...
      }
    });

    GlideModal - renderWithContent(객체 html)

    지정된 객체 기반 HTML 컨텐츠를 사용하여 모달을 표시합니다.

    HTML에서 모달 내용을 파생할 때 render() 메서드 대신 renderWithContent() 메서드를 사용합니다.

    표 10. 매개변수
    이름 유형 설명
    HTML 객체 모달에 표시할 HTML 콘텐츠입니다.
    표 11. 반환
    유형 설명
    void

    다음예제에서는 모달에 "Hello World"를 표시하는 방법을 보여 줍니다.

    var dialog = new GlideModal();
    dialog.renderWithContent('<div>Hello World</div>');

    GlideModal - renderWithContent(String html)

    지정된 문자열 기반 HTML 컨텐츠로 모달을 표시합니다.

    HTML에서 모달 내용을 파생할 때 render() 메서드 대신 renderWithContent() 메서드를 사용합니다.

    표 12. 매개변수
    이름 유형 설명
    HTML 문자열 모달에 표시할 HTML 콘텐츠입니다.
    표 13. 반환
    유형 설명
    void

    이 코드 예제에서는 사용자가 선택할 수 있는 선택 목록이 포함된 전달된 HTML 문자열을 사용하여 생성된 모달을 표시하는 방법을 보여 줍니다.

    function cancelDialog(){
    
      var dialog = new GlideModal('cancelTask');
      //Sets the dialog title
      dialog.setTitle('Cancel Task');
      //Set up valid custom HTML to display
      dialog.renderWithContent('<div style="padding:15px"><p>What action do you want to take?</p>
        <p><select name="cancellation" id="taskCancellation" class="form-control">
        <option value="cancelOnly" role="option">Cancel this task but keep the requested item open</option>
        <option value="cancelAll" role="option">Cancel this and all other tasks, closing the requested item</option>
        </select></p><div style="padding:5px;float:right"><button style="padding:5px;margin-right:10px"      onclick="window.changeTaskAction(this.innerHTML,jQuery(\'#taskCancellation\').val())"      class="btn btn-default">Abort</button><button style="padding:5px" class="btn btn-primary"      onclick="window.changeTaskAction(this.innerHTML,jQuery(\'#taskCancellation\').val())">Cancel Task</button></div></div>');
    
      //Use the windows object to ensure the code is accessible from the modal dialog
      window.changeTaskAction = function(thisButton, thisAction){
    
        //Close the GlideModal dialog window
        dialog.destroy();
    
        //Submit to the back-end
        if(thisButton=='Cancel Task'){
          if(thisAction=="cancelAll"){
            g_form.setValue('state',4);//Closed Incomplete -- will close the Requested Item and all other open tasks
          }else{
            g_form.setValue('state',7);//Closed Skipped -- will only close this task
          }
             //Regular ServiceNow form submission
             gsftSubmit(null, g_form.getFormElement(), 'cancel_sc_task');
          }
       };
       return false;//Prevents the form from submitting when the dialog first load
    }

    GlideModal - setPreference(문자열 이름, 문자열 값)

    지정된 기본 설정(속성)의 값을 설정합니다. 기본 설정을 사용하여 렌더링되는 페이지에 데이터를 전달합니다.

    UI 페이지에서 기본 설정을 검색하려면 RP.getWindowProperties().get('preference_name') 함수를 사용합니다. 기본 설정에 대한 자세한 내용은 을 참조하십시오 GlideModal - 클라이언트.

    표 14. 매개변수
    이름 유형 설명
    이름 문자열 값을 설정할 기본 설정의 이름입니다.
    문자열 지정된 기본 설정에 저장할 값입니다.
    표 15. 반환
    유형 설명
    void

    다음 코드 예제에서는 기본 설정을 'task'로 설정하고 name 기본 설정을 'value'로 설정하는 table 방법을 보여 줍니다.

    var dialog = new GlideModal('UI_dialog_name');
    
    //Set the dialog title
    dialog.setTitle('Show title'); 
    
    //Set the desired preferences
    dialog.setPreference('table', 'task'); 			
    dialog.setPreference('name', 'value');        	
    
    //Opens the dialog
    dialog.render();

    다음 예제에서는 glide_confirm 모달에서 기본 기본 설정을 지정하는 방법을 보여 줍니다.

    var dialog = new GlideModal('glide_confirm', true, 300);
      dialog.setTitle('Example Title');
      dialog.setPreference('body', 'Example Body');
      dialog.setPreference('focusTrap', true);
      dialog.setPreference('callbackParam', 'exampleParameter');
      dialog.setPreference('buttonClassComplete', 'btn-primary');
      dialog.setPreference('onPromptComplete', function(param) {
        console.log('Prompt completed with param: ' + param);
      });
    
      dialog.setPreference('onPromptCancel', function(param) {
        console.log('Prompt cancelled with param: ' + param);
      });
    
    dialog.render();

    GlideModal - setPreferenceAndReload(배열 속성)

    지정된 기본 설정을 설정한 후 모달을 다시 로드합니다.

    표 16. 매개변수
    이름 유형 설명
    속성 배열 기본 설정으로 설정할 이름-값 쌍.
    표 17. 반환
    유형 설명
    void

    이 예제에서는 모달을 만들고 렌더링한 다음 본문 기본 설정을 업데이트하고 모달을 다시 로드하는 방법을 보여 줍니다.

    var dialog = new GlideModal('glide_confirm');
    dialog.setPreference('body', 'This is a test modal body');
    dialog.setTitle('This is a test modal title');
    dialog.render();
    
    ...
    
    dialog.setPreferenceAndReload({'body': 'this is another body'})

    GlideModal - setTitle(문자열 제목)

    모달의 제목을 설정합니다.

    표 18. 매개변수
    이름 유형 설명
    제목 문자열 모달 제목에 표시할 텍스트입니다.
    표 19. 반환
    유형 설명
    void

    다음 코드 예제에서는 모달 제목을 "업데이트할 테이블"로 설정하는 방법을 보여 줍니다.

    var dialog = new GlideModal('UI_dialog_name');
    
    //Sets the dialog title
    dialog.setTitle('Table to update'); 
    dialog.setPreference('table', 'task'); 			      	
    dialog.setWidth(550);
    
    //Opens the dialog
    dialog.render();

    GlideModal - setWidth(숫자/문자열 너비)

    모달의 너비를 설정합니다.

    메서드를 사용하여 API를 처음 인스턴스화할 때 모달의 너비를 GlideModal - GlideModal(문자열 ID, 부울 읽기 전용, 숫자/문자열 너비) 설정할 수도 있습니다.

    표 20. 매개변수
    이름 유형 설명
    width 숫자 또는 문자열 모달의 너비(픽셀 단위) 또는 모달 CSS 클래스입니다. 픽셀 너비가 전달되면 지정된 너비가 해당 CSS 클래스와 정렬됩니다.
    가능한 모달 CSS 클래스:
    • modal-alert : (300px) 지정된 너비가 0에서 349 픽셀 인 경우 할당됩니다.
    • modal-sm: (400픽셀) 지정된 너비가 350에서 449픽셀인 경우 할당됩니다.
    • modal-md: (600픽셀) 지정된 너비가 450에서 649픽셀인 경우 할당됩니다.
    • modal-lg: (900픽셀) 지정된 너비가 650에서 900픽셀인 경우 할당됩니다.

    최대 너비: 900픽셀

    표 21. 반환
    유형 설명
    void

    다음 코드 예제에서는 모달 너비를 550픽셀로 설정하는 방법을 보여 줍니다.

    var dialog = new GlideModal('UI_dialog_name');
    
    //Sets the dialog title
    dialog.setTitle('Show title'); 
    dialog.setPreference('name', 'value'); 			      	
    dialog.setWidth(550);
    
    //Opens the dialog
    dialog.render();

    GlideModal - switchView(String newView)

    뷰를 변경하고 모달을 다시 로드합니다.

    표 22. 매개변수
    이름 유형 설명
    새 뷰 문자열 사용할 뷰입니다.
    표 23. 반환
    유형 설명
    void

    이 예제는어떻게