Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

In interactive grid, Conditionally set column required on page load

I have a grid, in which I have 10-15 rows of questions. sample query similar to my grid sql:

select QUESTION_NO,
QUESTION_TEXT,
YES_RESPONSE,
NO_REPONSE,
REMARKS,
ID,
ANSWER,
' ' as Answer_VALUE,
is_required
from GRID_QUESTIONS

I need to on the grid loading, programmatically set the remarks column (textarea) required if on the same row the is_required is set to Y.

Code I have right now to handle this:

var ig$ = apex.region("questiongrid").widget();
var gridView = ig$.interactiveGrid("getViews", "grid");
var model = gridView.model;

model.forEach(function(record, index) {
var statusValue = model.getValue(record, "IS_REQUIRED");
if (statusValue === 'Y') {
var cellElement = gridView.view$.find("td[data-col='REMARKS']").eq(index);
cellElement.prop("required",true);
}
else {
var cellElement = gridView.view$.find("td[data-col='REMARKS']").eq(index);
cellElement.prop("required",false);

}
});

Code is running BUT not setting the required property… Does anyone see the issue I am missing?

Thank you!

Tony MIller
White Rock, NM

This post has been answered by Karel Ekema on Sep 5 2024
Jump to Answer
Comments
Post Details
Added on Sep 5 2024
14 comments
627 views