Search This Blog

Monday, March 4, 2013

Add/Remove row from a table and subsequently Refresh a table

Add/Remove row from a table and subsequently Refresh a table.

The button ID is referenced in the table's "partialTrigger" property so that clicking the button initiates a table refresh

BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding operationBinding = bindings.getOperationBinding("Commit");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
//handle errors if any //... return;
}
AdfFacesContext.getCurrentInstance().addPartialTarget( this.getDepartmentsTable());

----------------------------------
1. Creating a binding for the table on which you want to delete the row. Binding creates setter method setMyTable(RichTable table) and getter method like getMyTable() returning RichTable.

2. On a button click or on any other action delete the table row as below.

DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("MyVOIterator");
Row currentRow = dciter.getCurrentRow();
dciter.removeCurrentRow();
AdfFacesContext.getCurrentInstance().addPartialTarget( this.getMyTable());

No comments:

Post a Comment