2
votes

I'm trying to figure out if this is possible in Oracle APEX interactive grids. I'm wanting to insert a string of text like "Y" into a cell simply by clicking the cell. I'm trying to avoid using a checkbox.

2

2 Answers

0
votes

Blockquote

Please follow the below steps to achieve the desired result

Paste the below JavaScript code in Function and Global Variable Decleration:

function fSwitch(ptext) {
  if(ptext == 'Y') {
     return ("");
  }
  else {
     return 'Y'
  }
}  

Make the Interactive Grid Editable

Change Column Type of the column that you want to insert a string to "Text Field".

Paste the below code in the Advanced -> Custom Attributes of the column that you want to insert a string

onclick="javascript:this.value=fSwitch(this.value)"; onkeypress="return false;"

How this works:

On focus of the column cell,

  1. If the cell is empty 'Y' will be entered,
  2. If the cell contains 'Y' then the cell value becomes NULL;
0
votes

There's a built-in "Switch" type for interactive grids which can be used to create yes/no columns. Would that work?

For an example, go to the App Gallery and install the Sample Interactive Grids app. Run it and navigate to Editing > Other Column Types, then look at the "On Leave" column.