Saturday, January 31, 2015

Preselected CheckBox - SelectBooleanCheckBox in ADF Table

In this post, I will be extending the application from the post CheckBox in ADF Table and retrieve selected rows .

The use case is very common. When the table with checkbox (SelectBooleanCheckBox) in the rows is rendered, there should be preselected checkbox in the rows depending on some condition. To make it simple to understand in this post ,when the Departments Table is loaded on the page, the checkbox should be ticked for Departments IT and Marketing.


Lets get into the implementation.

For this use case, lets add a method in AMImpl class which has the logic to tick or pres elect the checkboxes for rows having department name as IT and Marketing. Below is the code in AMImpl class. Note that VOImpl and VORowImpl classes has been generated for DepartmentsVO.





This code iterates over the Department Rows and check for the condition. If the condition is met, it just sets the Transient Boolean SelectRow variable to true. This makes it checked.

Note the condition here is very simple. This can be any complex condition based on requirement where the checkbox in the row needs to be checked.

Now expose this method as client interface in AM. Thats all in Model .

In ViewControllerProject, Created a simple task flow with one view activity. This task flow has a default activity as method activity which is the method from our AMImpl class which has the logic to preselect the checkbox based on condition.




In the preselected page fragment, the DepartmentsVO is dragged to create a readonly table.

Created a simple test page and created a region out of the task flow.

Thats it, if we run the test page, below is how it looks.



Thanks !!









2 comments:

  1. very nice post, thank you for posting this.
    for Latest Tech News check my blog Latest News Update 24x7.

    ReplyDelete
  2. In case you are interested in generating cash from your websites by popunder advertisments - you can try one of the highest paying networks: PopAds.

    ReplyDelete