+1 vote
3.0k views
in Coach Views by (130 points)
1.How to set visibility in the Event section of button or how to call function.

2.How to set the visibility in coach view I mean inside load or change.

1 Answer

+1 vote
by (720 points)

This is a bit of different scenario but this may help you understand complete solution.
 

Let’s take a problem statement and try to solve.

Problem Statement:

I have a table with three columns, Like –

When I select ‘No’ from the Selection column the other two cells of that row should be disabled and if I select ‘Yes’, cells should be editable.

Solution:

First we need to know the index of the Selection radio button –

// Get the row index of checked radio button
var index = me.ui.getIndex();

Then, we need to get the Coach View instance for the “Name” and “Value” cells of that row –

// sampleList1, name1 and value1 are the control ids of the table, name textbox and value textbox respectively

var nameView = page.ui.get('/sampleList1/name1['+index+']');
var valueView = page.ui.get('/sampleList1/value1['+index+']');

Next, we need to get the selected value of the radio button for that row –

me.getData()

Finally, to achieve the requirement, we need to combine the above piece of codes and add a logic to set the visibility of the textboxes based on the selected value of the radio button –

// Get current row index
var index = me.ui.getIndex();

// Get Coach View instance of the name and value textbox
var nameView = page.ui.get('/sampleList1/name1['+index+']');
var valueView = page.ui.get('/sampleList1/value1['+index+']');

// Set the visibility of the textboxes based on the selected value of the radio button

if(me.getData() == "Y"){
	nameView.context.options._metadata.visibility.set('value', "DEFAULT");
	valueView.context.options._metadata.visibility.set('value', "DEFAULT");
} else {
	valueView.context.options._metadata.visibility.set('value', "READONLY");
	nameView.context.options._metadata.visibility.set('value', "READONLY");
}

Related questions

0 votes
0 answers 1.0k views
0 votes
1 answer 1.1k views
0 votes
0 answers 625 views
asked Feb 13, 2021 by Manana (190 points)
0 votes
0 answers 2.7k views
0 votes
1 answer 679 views
0 votes
1 answer 1.7k views
0 votes
1 answer 1.5k views
0 votes
0 answers 322 views
0 votes
0 answers 831 views
0 votes
2 answers 3.3k views
0 votes
1 answer 1.7k views

635 questions

495 answers

98 comments

3.0k users

Join BPM Community Discord Channel

Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.
Created by Dosvak LLC
Our Youtube Channel
...