Tag Archives: table

How To in Jdeveloper ADF Tutorials – get the selected table rows


This is a useful handy code to get the selected rows for the table.

What it does:

  • Get handle to the table using the JSFUtils find component method with the table id passed as a parameter
  • Get the selectedRowKeys for the table
  • Iterate through the rowkeys
  • Get the rowkey from the iterator
  • Add the rowkeys into a list
  • return the list to the caller

This method takes the table id as the parameter


private List getSelectedList(String tableName) {
RichTable rt = (RichTable)JSFUtils.findComponentInRoot(tableName);
RowKeySet keySet = rt.getSelectedRowKeys();
Iterator iter = keySet.iterator();
iter = keySet.iterator();
List list = new ArrayList();
while (iter.hasNext()) {
list.add(iter.next());
}
return list;
}

Usage:

This method is used to check if any rows are selected for the particular table. The method returns the rowkeys of the rows selected if there are any rows selected for the table

How to select entire row using checkbox


To select all the rows in a table design a page like

 

 

 

 

 

 

create a binding to the table, the valuechangelistener of the checkbox will have the following code


 

 

 

 

 

working example can be downloaded from

http://adfproject.googlecode.com/files/SelectAllRowsInATable.zip

How to change the default text title of Detached table/treetable


have trindad-skins.xml in your web-inf folder and have the following tag

<skin>
 <id>dummy.desktop</id> // you are overriding the style
 <family>dummy</family>
 <extends>fusion.desktop</extends> // this should be from the trinidad-config.cml
 <render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
 <style-sheet-name>skins/dummy/dummy.css</style-sheet-name>
 <bundle-name>oracle.view.resource.rich.SkinBundle</bundle-name> // your skin bundle to override the name
 </skin>

here dummy.css is used to override any visual property of the faces component defined in fusion theme
to override the label, use in the SkinBundle like (The java bundle file should be registered as a managed bean in adfc-config.xml)

package oracle.view.resource.rich;
 import java.util.ListResourceBundle;
public class SkinBundle
 extends ListResourceBundle
 {
 @Override
 public Object[] getContents()
 {
 return _CONTENTS;
 }

static private final Object[] _CONTENTS =
 {
 { "af_panelCollection.LABEL_DETACH_TABLE_DLG", "Any name for the Detachable Table" },
 { "af_panelCollection.LABEL_DETACH_TREE_TABLE_DLG", "Any name for the Detachable Tree Table" }
 };
 }