← Back to list

Oj-table: Row Selection checkbox enablement and disablement in Oracle VBCS.

Hi Devs👋,

Mohd Ahshan Danish · 2023-03-05 06:21 · 9 claps · 1.6 min read
#ojet #oracle-vbcs #vbcs #oracle-jet
Open on Medium ↗
Wiki topics: 🏛️ · Politics

Oj-table: Row Selection checkbox enablement and disablement in Oracle VBCS.

made by myself.

made by myself.

Hi Devs👋,

Recently, I came across a requirement to enable and disable the selection checkbox in the oj-table.👷

Oj-table (>13.1.x) does not provide direct attributes for enablement and disablement of checkboxes. 😢

There is an attribute to easily implement it in version 13.1.x and later. (row.selectable).

row.selectable : This callback will be invoked and allows you to control selection on individual rows in version 13.1.x and later..

More information can be found in the document.🤷‍♂️

Here, we are going to see a workaround for OJet version >13.1.x.

Add Listener for “on-selected-changed”:

 <oj-table class="oj-flex-item oj-md-12" aria-label="Table" 
data="[[dataprovider]]" 
selection-mode='{"row": "multiple"}' 
on-selected-changed="[[selectionListener]]"
selected.row="{{selectedItems}}">
</oj-table>

I’m using ADP, so I’ve already filtered the record IDs that can be selected in the variable selectableRowIds.

selectionListener(event, model) {
        var selected = event.detail.value.row;
        if (selected.isAddAll()) {
          let k = new keyset.KeySetImpl(model.selectableRowIds);
          model.selectedItems(k);
        } else {
          let r = model.selectedItems().values();
          for (let key of r) {
            if (!model.selectableRowIds.includes(key)) {
              r.delete(key); // remove non selectable Id
            }
          }
          let k = new keyset.KeySetImpl(r);
          model.selectedItems(k);
        }
      };

You can see in the above code that there are two scenarios below.

  1. If select all is checked, then create a key for all selectableRowIds and update selectedItems.
let k = new keyset.KeySetImpl(model.selectableRowIds);
          model.selectedItems(k);
  1. If the user has selected a particular row, then check if the row key is in “selectableRowIds,” otherwise delete it from the “selectedItems” variable, selectedItems variable is referring to all selected rows.

By this way, you can control the selection of checkboxes in the OJ-table using script.

➡️ Please refer to my previous post below on oj-table.

[embed]oj-table : select all and clear selected in oracle jet / oracle vbcs Hi Devs👋,medium.com

Well, I guess, that’s it.😄 Nothing can beat self-effort ⛹️‍♂️ toward learning, and it is something that I value highly.

Have fun!

Follow me on **LinkedIn**.

If you have any other additions to this, you can leave a comment below, and if you like this post, please hit clap. 👏and consider following me on Medium.


메타데이터
post_id
d02456e2d598
slug
oj-table-row-selection-checkbox-enablement-and-disablement-in-oracle-vbcs-d02456e2d598
url
https://medium.com/@mohdadanish/oj-table-row-selection-checkbox-enablement-and-disablement-in-oracle-vbcs-d02456e2d598
canonical_url
https://medium.com/@mohdadanish/oj-table-row-selection-checkbox-enablement-and-disablement-in-oracle-vbcs-d02456e2d598
author_url
https://medium.com/@mohdadanish
status
ok
fetched_at
2026-06-29 01:02:39