Select multiple rows using Check box

One of the requirements is that you want to display a table of rows in a table , and the user select some rows using checkbox then insert,or updates these rows.

1- in your view object , add transient attribute "TransSelected" of type Boolean

2- drag and drop the view object from the data control as table
3- by default, the "TransSelected" is displayed as input text, delete the input text from within the column and drag and drop it again from the data control inside the column as selectOneBooleanCheckBox

4- in the "Edit binding Dialog box " Enter true , for selected state value , and false for UnSelected State Value

5- Now we will implement the multi-select action.The simplest way to get the selected rows is to use the "getFilteredRows()" view object's method. This is a built in method for any View Object
The "getFilteredRows()" returns array of Row object.

Example: add a button on you page and implements its action as follow:

    public String processSelectedRows() {
        String output = null;      
    
            DCIteratorBinding reqItr = ADFUtils.findIterator("EmpViewIterator");
            ViewObject vo = empItr.getViewObject();
            Boolean selected = null;
            Row[] rows = vo.getFilteredRows("TransSelected", true);
          for (Row row : rows) {
            if (row != null) {
               System.out.println("Employee Name =" + row.getAttribute("EmpName"));
              }
           }
  return output ;
}







Comments

Popular posts from this blog

Another user has changed the row with primary key oracle.jbo.Key[12 ].

weblogic windows JPS-01050: Opening of wallet based credential store failed. Reason java.io.IOException: Failed to lock cwallet.sso.lck

Working With File Throgh WebUtill