NOTE - The approach shown in this blog is no longer going to work with newer versions of Oracle JET/ Visual Builder. Here is an updated blog that shows the new simpler way to achieve this with JET 9. For JET 8.1 you can adopt the approach shown here.
This blog will show you how to add a checkbox to rows in a table to allow you to pick specific rows. Note that an alternative approach to selecting multiple rows in a table is to use the built in multi-row selection capabilities of the JET table as shown here, but some users find it easier to use a check box so...
To achieve this, you'll want to base your table on an ArrayDataProvide rather than an ServiceDataProvider - this way you'll be able to access the values in the rows later to figure out which ones were selected.
You'll add a new boolean attribute to your ADP to track if a row is selected or not - selecting a row will turn the value of this attribute to true.
For the check box, we are going to use the "boolean checkbox component" - one of the components available in the Visual Builder Component Exchange. Once you add the component to your VB application, you can drag it onto your table's empty column, and hook the value of the new boolean field you introduced.
<oj-ext-checkbox-switch :id="[['oj-ext-checkbox-switch--2147249178-1-' + $current.index]]" value="{{ $current.row.selected }}"></oj-ext-checkbox-switch>
In the video you can also see how to use the for loop and if logic actions in an action chain to loop over the records in the table and check the value in the field using this expression{{ $page.variables.DeptADP.data[$current.index].selected }}
Check out the quick demo here:
https://drive.google.com/open?id=1X0gaQ72Nr_W0RfGU9ETthS7FyZEbSFCL
https://cloudcustomerconnect.oracle.com/resources/e610f4723c/summary
From a quick scan looks like you have an extra level of array in your object []
When I am trying to assign value of the checkbox component as {{$current.row.Selected}}, there is an error coming up as
"Cannot set the value true/false to property Selected of the variable ' projectLOVADP_value 'as it disallows property writes. Use VB actions like assignVariablesAction to update the variable instead."
In the above message "projectLOVADP" is my ADP.
Any help around this would be of great help.
Thanks in advance.
Hope you are doing well.
After saving the data and re-open the same record selected check box is disappeared from the list.
May i know what is the issue and solution for this?
For further questions post on our forum - https://cloudcustomerconnect.oracle.com/resources/e610f4723c/summary
Please make a video on Client Side validation.
Thank You
How to provide select all option in VBCS?
In any case you can use the selected attribute of the table to have all the rows selected.
For further questions use our forum:
https://cloudcustomerconnect.oracle.com/resources/e610f4723c/summary