Implement MultiSelect Deletion using check box in ADF
There are two approaches defined in various blogs.
Creating a transient attribute(Common in all blogs), will discuss about code execution on button click.
Code 1
public String deleteCheckedRows() {
DCBindingContainer bindings = (DCBindingContainer)getBindings();
DCIteratorBinding iter =
(DCIteratorBinding)bindings.findIteratorBinding("EmployeesView1Iterator");
System.out.println("iter.getViewObject().getEstimatedRowCount()::" +
iter.getViewObject().getEstimatedRowCount());
for (int i = 0; i < iter.getViewObject().getEstimatedRowCount(); i++) {
Row row = iter.getRowAtRangeIndex(i);
if (true == row.getAttribute("SelectedRow"))
row.remove();
}
return null;
}
Code 2
public void deleteMultiple(ActionEvent actionEvent) {
DCBindingContainer bindings = getBindings();
DCIteratorBinding iteratorBinding = bindings.findIteratorBinding("EmployeesEOView1Iterator");
Row[] r = iteratorBinding.getViewObject().getFilteredRows("TestBool", true);
for (int i = 0; i < r.length; i++) {
r[i].remove();
}
}
1)With code 1 you are most likely to getNull pointer Exception or set rangeSize = -1 for code 1 to work.
2) Code 1 is not deleting all selected rows .
I am using Jdev 11.1.17.0 because of some client requirements.
http://www.baigzeeshan.com/2010/06/deleting-multi-selected-rows-from-
adf.htmlhttp://adfsonal.blogspot.in/2013/07/adf-deleting-multi-selected-rows-
http://adfsonal.blogspot.in/2013/07/adf-deleting-multi-selected-rows-from.html
There are two approaches defined in various blogs.
Creating a transient attribute(Common in all blogs), will discuss about code execution on button click.
Code 1
public String deleteCheckedRows() {
DCBindingContainer bindings = (DCBindingContainer)getBindings();
DCIteratorBinding iter =
(DCIteratorBinding)bindings.findIteratorBinding("EmployeesView1Iterator");
System.out.println("iter.getViewObject().getEstimatedRowCount()::" +
iter.getViewObject().getEstimatedRowCount());
for (int i = 0; i < iter.getViewObject().getEstimatedRowCount(); i++) {
Row row = iter.getRowAtRangeIndex(i);
if (true == row.getAttribute("SelectedRow"))
row.remove();
}
return null;
}
Code 2
public void deleteMultiple(ActionEvent actionEvent) {
DCBindingContainer bindings = getBindings();
DCIteratorBinding iteratorBinding = bindings.findIteratorBinding("EmployeesEOView1Iterator");
Row[] r = iteratorBinding.getViewObject().getFilteredRows("TestBool", true);
for (int i = 0; i < r.length; i++) {
r[i].remove();
}
}
1)With code 1 you are most likely to getNull pointer Exception or set rangeSize = -1 for code 1 to work.
2) Code 1 is not deleting all selected rows .
I am using Jdev 11.1.17.0 because of some client requirements.
http://www.baigzeeshan.com/2010/06/deleting-multi-selected-rows-from-
adf.htmlhttp://adfsonal.blogspot.in/2013/07/adf-deleting-multi-selected-rows-
http://adfsonal.blogspot.in/2013/07/adf-deleting-multi-selected-rows-from.html
No comments:
Post a Comment