Conditional Link in APEX Tabular Form

Description:

Conditional link is the common requirement all over application development. As a requirement goes with Users and Roles, Conditionally, we may have to hide/disable links for different users and roles. Form level it will be easy. But when it comes to tabular form, it is somewhat typical. I have done this in tabular form with JQuery without using any loop, which will lead to performance issues.

 

It has been done as Role-based Conditional link.

 

Step:1: Maintain hidden column in tabular form to maintain the role against each entry.

 

Step:2: In Page Load and after refresh event include this.

Execute Javascript code event

$(“#report_del_item .t-Report-report      td[headers=’GENERAL_COMMENTS’]”)

.each(function(){var a = $(this).children(“input[name=’f15′]”).val();

if (a ==’Developer’ || a ==’Validator’ || a ==’Reviewer’) {

$(this).closest(‘tr’).find(“td[headers=’TITLE’] a”).attr( “href”, “javascript:void(0);”).css({“cursor”:”default”,”color”: “black”});

 

} });

#report_del_item  – Static Id of Report.

td[headers=’GENERAL_COMMENTS’] – Represents General Comments Column

 

$(this).children(“input[name=’f15′]”) – Represents role hidden column id , Children been specified as all hidden columns will be children to last visbile/display column.

 

.closest(‘tr’)  – Finds closest table row <tr>

.find(“td[headers=’TITLE’] a”) – Finds selector with anchor in table data having header as ‘TITLE’

 

.attr( “href”, “javascript:void(0);”) – Sets attribute href to void which returns none

.css({“cursor”:”default”,”color”: “black”}) – Sets style with normal cursor and black colored font.

 

Output:

 

Notice Title column on both screenshots, which is link but It is displayed conditionally.

Summary: This post explains about Global Alert Box in APEX

Queries?

Do drop a note by writing us at contact@staging.doyensys.com or use the comment section below to ask your questions.

 

Recent Posts