20210323 - IG Interactive Grid - 각 Row에 버튼 생성하고 PL/SQL로 프로세싱(1)

IG의 각 Row에 버튼을 생성하기 위해 SQL에서 HTML을 작성하였으나 일부 작동에 두 가지 문제가 발생.


SQL :

case APR_YN

when 'Y' then '<span style="text-align=center">Completed</span>'

else '<button onclick="javascript:alert(123)" class="t-Button t-Button--default t-Button--hot t-Button--stretch">Proc Required</button>'

end APR_YN


  1. 버튼은 잘 생성되었고 alert 메세지도 작동을 하였으나 그 이후 자동적으로 페이지가 Refresh 되는 현상이 있고,
  2. 버튼을 눌렀을 때 PL/SQL 로 프로세싱이 필요한 상황에 Dynamic Action/Process를 제어할 수가 없었음. (예를 들어 각 Row는 주문 정보라고 하면 관리자는 주문 내용을 확인하고 필요에 따라 일부를 수정할 수 있고, 체크가 끝나면 주문하는 프로세스를 버튼을 클릭하여 진행)



APEX 전문가 Comment :

I recommend to not generate HTML in SQL. Use an HTML Expression column instead. Use substitutions to put any needed context such as a primary key into the button markup as data- attributes. Use the button builder from the UT sample app to make a nice looking button. Give the button a distinct class (in addition to all the style classes) such as js-do-that-thing. 


I recommend to not use javascript: pseudo scheme URLs.


Next create a delegated click handler on the IG region. This is a DA with event click and dynamic scope. Give the IG region a static id such as ‘myIG’. Set the DA selection type to jQuery Selector and for the selector use the button class ‘.do-that-thing’. Then set event scope to dynamic and in the static container enter a selector for the reiong '#myIG'.


Then you can use an Execute PL/SQL Code action. You can first use a JavaScript action to extract any context info from the button data- attributes and put it in page items to be sent in the PL/SQL action.


요약하면, 

  • SQL 에서 HTML 생성하지 말고 컬럼을 가져와 Type을 HTML Expression 사용
  • 버튼에 Primary Key 같은 값을 셋팅, Class 할당하여 활용
  • IG 리전에서 static id 를 지정하여 DA Click Event >> jQuery Selector >> Execute PL/SQL



20210323.


20210322 - 참고 사이트 모음


1. Universal Theme - https://apex.oracle.com/pls/apex/apex_pm/r/ut/getting-started

2. Sample - https://apex.oracle.com/pls/apex/f?p=23606:2::::::

3. APEX JavaScript API Reference - https://docs.oracle.com/en/database/oracle/application-express/21.1/aexjs/index.html

4. APEX API Reference - https://docs.oracle.com/en/database/oracle/application-express/21.1/aeapi/index.html

7. APEX Member of the Month - https://apex.world/ords/f?p=100:427:::NO:::



20210719.

20210322 - Oracle APEX 시작하기

Oracle Application Express, Oracle APEX.

여러가지 Low Code 플랫폼이 있을테지만 Oracle DB SQL과 PL/SQL을 최대한 활용할 수 있는 Oracle APEX에 대한 여러 가지 주제를 다뤄보고자 한다.


시작하는 방법에는 여러가지가 있는데

1) Oracle Cloud - APEX on Autonomous Database : 유료

2) Oracle Cloud - APEX Cloud Service : 유료

3) Oracle Cloud - APEX on Database Cloud Service : 유료

4) Oracle Cloud - APEX on (Always Free) Autonomous Database : 작지만 무료

5) apex.oracle.com - 계정 생성 후 테스트 가능 : 작지만 무료


그 외 compute instance에 ORDS + DB + APEX를 설치하거나 기존 Oracle DB가 있는 곳에 설치해서 활용 가능하다.


메인 사이트에 계정을 생성하여 테스트 해 볼 수 있음. 단, 일정 기간 사용하지 않으면 생성해 둔 APP을 Purge 하는 절차가 있으니 주의를 필요로 하고, 어딘가 문구에 운영 Production 으로 사용하면 안 된다고 표현되어 있음.

https://apex.oracle.com/ko/







설치에 대해서는 별도로 페이지를 작성하여 추후 설명을 할 예정임.


20210322.

20250202 - IG 다운로드 버튼 바로 보이기

JS initialization Code : function (config) {     var $ = apex.jQuery,         toolbarData = $.apex.interactiveGrid.copyDefaultToolbar(),  ...