Oracle Apex Utility Note Series 3-component read-only

Source: Internet
Author: User
Tags numeric value

1. Common components

For Apex various components (page, Region, item, button, etc.) can be set to read-only under certain conditions. Their settings are similar, and the following are also read as examples.

In the component view (Component view)

1. Click a region

2. Click the Read Only tab

3. Select a condition type, there are many options. Simple can be an expression that is not null or two expressions (not) equal. The author often uses PL/SQL Expression or PL/Returning a Boolean because they can support more complex custom logic.

4. Determine and apply the change and it will work.

2. Report column components The author discovers in the development process that the report itself can be set to read-only under a certain condition in the way described above. But if the requirement is only a few columns read-only, a slightly more complex setting is required. Steps are as follows: 1) Create a hidden item at apex, such as p1_condition;2, to create a PL/SQL function in the database to return a value (can be a numeric value, a string or a Boolean); 3) at Apex Create a before Header process, call the function and assign to the previously established hidden item;4) create a dynamic action on page load at apex, execute the JavaScript script, The pseudo-code for the approximate process is as follows:
1. Get the value of hidden item
var cond = $v (' p1_condition '); $v function to get the value of an item


2. Comparison criteria
if (cond = ' ABCD ') {
3. Get report Columns
var Col1array = $ (' input[name= "f02"] '); Use jquery selector to get a column of a report

col2, col3 for columns that you want read-only
var col2idprefix= "f03_";
var col3idprefix = "f04_";

$.each (Col1array, function (index,obj1) {
Calculate the ID of the cell corresponding to each column
var tmpid= (index+1);
var idstr = "0000" + tmpid;
var idstrlen = idstr.length;
var idsubstr = idstr.substring (Idstrlen-4,idstrlen);

var col2compid = ' # ' +col2idprefix +idsubstr;
var Col2comp = $ (col2compid);

var col3compid = ' # ' +col2idprefix +idsubstr;
var Col3comp = $ (col2compid);


Give each cell a read-only
Col2comp.attr ("ReadOnly", "ReadOnly");
Col3comp.attr ("ReadOnly", "ReadOnly");

});


}

Oracle Apex Utility Note Series 3-component read-only

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.