Hi everyone In this Post i will describe how to get multiple selected rows in View Object Impl Class
you can implement this logic to multiple deletion or to update multiple rows
For this example i am using jdeveloper 11.1.2.3.0
First of all add a Transient attribute in view object with Data type Boolean and make it Update able Always
Then click on Ui Hints Tab and select Check Box from Control Type
Now create a JSF page drop a panel collection from component palette
then drop VO on JSF page as Read only table
move the Selection Attribute at the top
and make sure the selection of Multi Rows
when your drop the VO on JSF page the Selection Attribute not appears as a check Box
so right click on inside of selection attribute and select Delete
Now from Data Control select the Selection attribute and drop it as a check box
like this
Now go to java of view object and create java classes of view object
to create classes click on pencil i con then checked the check boxes in the following way
Now open the view object "EmployeesViewImpl" class
and the at the end of this class write the following method
To add this method to the client Interface of the view object
click on java Tab of view object
click on pencil icon
then select and move method
Now to access this method in been follow the following steps
1) First add this method in client side bindings , for this
click on bindings of JSF page
Then from bindings click on green + icon
Then from Insert Item window select method action and click OK
After clicking OK "create Action binding" windows appear in front of you
Expend the "AppModuleDataControl"
Then select "EmployeesView1" and you will see the "getSelectedRow()" method
Now just click OK
and then click on Design Tab
Now on JSF page
drag and drop a button from component palette
then create a been with request scope and create a method in been name as "button method"
then bind the button with been method ("buttonMethod")
Now in "buttonMethod " call the "getSelectedRow" Method in the following way
firstly copy the id of the method from bindings
Then write the following code in been method
Now just Run you Application select some rows hit the "getRows" button and see the result in log file
you can implement this logic to multiple deletion or to update multiple rows
For this example i am using jdeveloper 11.1.2.3.0
First of all add a Transient attribute in view object with Data type Boolean and make it Update able Always
Then click on Ui Hints Tab and select Check Box from Control Type
Now create a JSF page drop a panel collection from component palette
then drop VO on JSF page as Read only table
move the Selection Attribute at the top
and make sure the selection of Multi Rows
when your drop the VO on JSF page the Selection Attribute not appears as a check Box
so right click on inside of selection attribute and select Delete
Now from Data Control select the Selection attribute and drop it as a check box
like this
Now go to java of view object and create java classes of view object
to create classes click on pencil i con then checked the check boxes in the following way
Now open the view object "EmployeesViewImpl" class
and the at the end of this class write the following method
To add this method to the client Interface of the view object
click on java Tab of view object
click on pencil icon
then select and move method
Now to access this method in been follow the following steps
1) First add this method in client side bindings , for this
click on bindings of JSF page
Then from bindings click on green + icon
Then from Insert Item window select method action and click OK
After clicking OK "create Action binding" windows appear in front of you
Expend the "AppModuleDataControl"
Then select "EmployeesView1" and you will see the "getSelectedRow()" method
Now just click OK
and then click on Design Tab
Now on JSF page
drag and drop a button from component palette
then create a been with request scope and create a method in been name as "button method"
then bind the button with been method ("buttonMethod")
Now in "buttonMethod " call the "getSelectedRow" Method in the following way
firstly copy the id of the method from bindings
Then write the following code in been method
Now just Run you Application select some rows hit the "getRows" button and see the result in log file
Please Feel Free To Ask if you Face any Difficulty
Like and share to help others
Thanks
Date 26-07-2016
Thanks
ReplyDeletei really need this stuff
:)
Delete