tags:

views:

36

answers:

2

Greetings:

Is there anyway to make an apex report table cell (or even the entire report itself) conditionally read-only in Apex 3.2? I don't see the "read-only" box anywhere in the options; tried searching everywhere.

Thanks in advance!

A: 

OK, I had an error in concept. I wanted to make a tabular form read-only. That's why I couldn't see the "read-only" box. If you open the source for the generated page, each column has given an id with the following naming convention:

id="f02_0001"

This table cell is in column 2, row 1. So, you can use JavaScript to loop through a column and modify it's properties. In this example, I use jQuery:

var payments = $("[id^='f08_']"); // get all cells for column 8

// loop through items
$.each(payments, function(){
   alert($('#'+this.id).val());       
   // make whatever changes you want to this.id, such as make read-only
});
maximus
To make this secure, you would need to render the items as readonly initially and have Javascript make them updateable for authorised users. Otherwise an unauthorised user could potentially circumvent the security by turning off Javascript in their browser.
Tony Andrews
+1  A: 

Since the whole tabform is to be made read-only for particular users, you can do this at rendering time rather than using Javascript. However, you would need 2 copies of each column:

  1. Column to be displayed for an authorised user, not readonly
  2. Identical column to be displayed for a non-authorised user, with Element Attributes set to readonly=readonly

Authorisation schemes can be used to control which columns are displayed to the user.

I was hoping to find a way to do this with a single column and a dynamic value for Element Attributes, but I couldn't get it to work.

Tony Andrews