- Drag and drop method return from Data Control Pallete in JDeveloper, and from pop-up window choose to create ADF Read-only Table. In my sample I'm using method return for Departments;
- In Edit Table Columns dialog select 'Enable selection' check-box. Press OK;
- Single-selection table in JSPX page is created;
- Using right mouse button, click on af:table element in Structure window and choose Properties;
- In Table Properties dialog select Formatting tab and instead 'Single Selection' choose 'Multiple Selection' for 'Include Selection Column' option. Press OK.
Ok, there is enough only five steps, to create multi-selection table, let's test it. When table is opened, first row is selected by default. Hm..., it is like in single-selection table.
If you do not care about first row selected by default, let's randomly select any three rows and press Select button:
After Select button is pressed, only row for 'Human Resources' becomes selected:
So, it seems something is not ok. I have decided to research more deeper and have created 'Action Method Binding' for Select button in Backing bean. This method retrieves keys for the selected rows and prints information contained in those rows.
When selectButton_action() method was implemented, I have tested created multi-selection table for the second time. I have selected three rows and pressed Select button, in JDeveloper Log window was displayed only one row (should be three):
07/02/17 12:01:32 Selected Department: Human Resources
So, finally we have found a problem - multi-selection is enabled, but it works like a single-selection. How to solve this? Thanks God, it is simple - there is one property we should remove for af:table component:
selectionState=
"#{bindings.findAllDepartments1.collectionModel.selectedRow}"
"#{bindings.findAllDepartments1.collectionModel.selectedRow}"
Yes, selectionState set to 'selectedRow' is not needed in multi-selection table - remove it. When this property is removed, multi-selection feature works fine. Output in JDeveloper Log window, when three rows are selected:
07/02/17 12:09:39 Selected Department: Human Resources
07/02/17 12:09:39 Selected Department: IT
07/02/17 12:09:39 Selected Department: Executive
07/02/17 12:09:39 Selected Department: IT
07/02/17 12:09:39 Selected Department: Executive
Download developed sample - MultiSelection.zip. Model layer for this sample is developed using Oracle TopLink, standard HR schema DEPARTMENTS table is used. View layer is implemented using Oracle ADF Faces. Sample contains one JSPX page - multiSelection.jspx, where described multi-selection table functionality is implemented.
14 comments:
Hi,
Can you please help me in implementing this feature.
I have Multi-select ADF table with bindings.my table is based on a Viewobject.
My requirement is to render two different icons in the last column of each row depending on selection state. For the selected rows,i need to display enabled icon, and for the other rows i need to show disabled icons.
To achieve this , should i add one more attribute selected in VO ??
Or is it possible to control the rendered property of those two icons thro' EL in jsp itself??
Thanks,
Senthil
Hi Senthil,
Frank Nimphius blogs about solution you need - ADF Faces: Conditional table row manipulation on table row select.
Regards,
Andrejus
Hai Andrejus ,
I want to implement the following features based on af:tableSelectMany
component.
I need to disable the checkboxes of af:tableSelectMany
component based on the value of a
a field in the table.
Ex:If the status field in the row is 'Y' I want to disable it.
Is it possible to do in ADF
Please help me
Thanks
Ans
Hi Ans,
I have seen something similar on the Web. If I will find solution, will post link here.
Regards,
Andrejus
hi in af:table we have multiple selection true, it is providing checkbox in each row it is fine but i want to display this check box top and remainings are in the bottom how it is possible can help anyone.
Hi,
Can you please help me implementing this feature.
I have multi select table bound to a View Object.
My requirement is to load the details of the selected rows in a popup. I tried implementing the way you have mentioned and I am able to do that. I can print the details of the rows on the JDev console but i am not able to load the details of more than 1 row in the popup. Details corresponding to only 1 row is loaded in the popup. In the popup, a jsff is loaded. I have dragged and dropped the view object as a form on the jsff. This view object is the same to which table is bound.
Another thing that I tried was, created a view link between the same View Object and dragged and dropped the View Object through View Link in the jsff. even then only one row is getting populated. I would really appreciate your response.
Hi,
You can't implement it so simple. Try to implement it programmatically.
Andrejus
Hi,
can you plz tell, how can I select a value from next set of contents.. like --- a vlaue from 10-20 range..
You are using ADF 10g?
Andrejus
yes .. I am using ADF 10g. Still I am getting the same error. After pressing next 10... I see the selected avlues as the result. NullPointerException occur
Hi,
I am using Jdev 10.1.3.2
and I am getting java.lang.ClassCastException: java.lang.Integer at line
Key key = (Key) itr.next();
Please help
thanks,
rache
me too got the same error. So I changed to this.
Object k = (Object) itr.next();
I am getting values from the first set of range.. that menas from 1 - 10 using the code
FacesContext fc = FacesContext.getCurrentInstance();
ValueBinding vb = fc.getApplication().createValueBinding("#{data}");
BindingContext bc = (BindingContext)vb.getValue(fc);
DCBindingContainer cnt2 = bc.findBindingContainer("pages_listprocess_calllistSearchResultPageDef");
DCIteratorBinding listIter = cnt2.findIteratorBinding("vwAgentCallListIterator");
RowSetIterator listRIter = listIter.getRowSetIterator();
RowKeySet selection = this.getMultiSelectionTable().getSelectionState();
Set keySet = selection.getKeySet();
Iterator itr = keySet.iterator();
//Set keySet = selection.getKeySet();
//Iterator itr = keySet.iterator();
System.out.println("========= SIZE ========= "+selection.getSize());
listNums = new Number[selection.getSize()];
agentId = new Number[selection.getSize()];
int i=0;
while (itr.hasNext()) {
Object k = (Object) itr.next();
vwAgentCallListRowImpl r = (vwAgentCallListRowImpl)listRIter.getRowAtRangeIndex(Integer.parseInt( k.toString()) );
//Row r= listRIter.getRowAtRangeIndex(Integer.parseInt( k.toString()) );
//Row r= custRSIter.getRowAtRangeIndex(Integer.parseInt( k.toString()) );
//System.out.println("Selected Customer: " + r.getAttribute("ListNo"));
listNums[i] = ((Number)r.getAttribute("ListNo"));
agentId[i] = ((Number)r.getAttribute("AgentId"));
i++;
}
But, after click next 10, the selection.getSize() displays the number of selected rows. but in the line
listNums[i] = ((Number)r.getAttribute("ListNo"));
got the nullpointerexception
Please help.... what to do next to solve the problem
Great tutorial but the link to download the project is not working.
Could you please make the project available?
Regards,
Simon.
All old samples are available in Google Archive - https://code.google.com/archive/p/jdevsamples/downloads
Regards,
Andrejus
Post a Comment