Requirement – Checking if data modified in viewobject ADF
Solution-You can use isDirty() method provided by API to get status
DCBindingContainer bind =(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry(); JUCtrlHierBinding object = (JUCtrlHierBinding)bind.findCtrlBinding("DepartmentVO1"); // or get ViewObject form Iterator in ADFUtils. ViewObject deptVo = object.getViewObject(); Boolean b = deptVo.getApplicationModule().getTransaction().isDirty();This gives Boolean value of True/False.
another way
DCBindingContainer dcBindingContainer=(DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry(); if(dcBindingContainer.getDataControl().isTransactionModified()){ //Code goes here... }
few more use case i found on internet i.e http://oracleadfhowto.blogspot.de/2012/03/iterator-uncommitted-data-availability.html, so thought of sharing that as well –
1. If you are using iterator based UI component like table:
Expression #{row.row.entities[0].entityState} will return state viz. (0 – New, Modified – 2, Unmodified – 1, Initialized – -1 where row refers to the table node and row.row is the instance of row in the iterator/table.
The following expression also notify that there is dirty data available –
-> #{!bindings.EmployeesView1Iterator.dataControl.TransactionDirty} // this statment will notify that there is uncommitted or unsaved data in the iterator -> #{!bindings.Commit.enabled} -> #{!controllerContext.currentRootViewPort.dataDirty} -> #{!controllerContext.currentViewPort.dataDirty}
Happy ADF learning with Vinay in techartifact….