Reg Row Selection in a Table UI Element

Hi All,
Can anyone help me in writing code to select a row from a table.
I need to read the data from a row selected in a table and print it in the next page of my application.
I request anyone to send me some coding line on how to select a row from a table and read data from it.
Regards,
Murthy.

Hi Narayana,
Follow the steps.
Step1: Create a WD Component.
Step2:  Under Component Controller create a
i)  2  Node “EmployeeInfo” and “EmployeeRecord”  with attribute “EmployeeName” and “Position”  of cardinality 0..n for both the node and a context attribute “WindowInstance” of type “com.sap.tc.webdynpro.services.session.api.IWDWindow”
Step3: Go to the Diagram View. Do the mapping between “EmployeeView” and “Component Controller” and between “DisplayView” and “Component Controller”
Step4: Design 2 Views layout
i>EmployeeView
Layout like
Employee Name |                                  Employee Position
EmployeeInfo.EmployeeName| EmployeeInfo.Position
EmployeeInfo.EmployeeName| EmployeeInfo.Position
DisplayResultButton
ii>DisplayView
Layout like
Employee Name   |                      Employee Position
EmployeeRecord.EmployeeName |    EmployeeRecord.Position
EmployeeRecord.EmployeeName |    EmployeeRecord.Position
CloseWindowButton
Step5: Create 2 Windows
1>EmployeeWindow
2>DisplayWindow.
Under “EmployeeWindow” add the “EmployeeView”
and “DisplayWindow” add the “DisplayView”
Step5: Associate action “DisplayResult” with the “DisplayResultButton” and use this code inside the Implementation of “EmployeeView”
public void wdDoInit()
    //@@begin wdDoInit()
//initialize nodes
wdContext.nodeEmployeeInfo().addElement(wdContext.createEmployeeInfoElement());
wdContext.nodeEmployeeRecord ().addElement(wdContext.createEmployeeRecordElement());
    //@@end
public void onActionDisplayResult(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
    //@@begin onActionDisplayResult(ServerEvent)
try
IPrivateDisplayView.IEmployeeRecordElement empRec =
wdContext.createEmployeeRecordElement();
int n = wdContext.nodeEmployeeInfo().size();
int leadSelected = wdContext.nodeEmployeeInfo().getLeadSelection();
// loop backwards to avoid index troubles     
for (int i = 0; i < n ; i++) {
if (wdContext.nodeEmployeeInfo().isMultiSelected(i) || leadSelected == i) {
empRec.setEmployeeName(wdContext.nodeEmployeeInfo().getElementAt(i).getAttributeValue("EmployeeName"));
empRec.setPosition(wdContext.nodeEmployeeInfo().getElementAt(i).getAttributeValue("Position"));
wdContext.nodeEmployeeRecord().addElement(empRec);
catch(Exception e)
e.printStackTrace();
IWDWindowInfo windowInfo =(IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows(
     "DisplayWindow");
//        create the Window
     IWDWindow window = wdComponentAPI.getWindowManager().createWindow(windowInfo, true);
     window.setWindowPosition(WDWindowPos.CENTER);
     window.setTitle("WindowTitle");
     window.setWindowSize(200,200);
//        Save WindowInstance in Context
     wdContext.currentContextElement().setWindowInstance(window);
//        and show the window
     window.show();
     //wdThis.wdFirePlugInDisplay();
    //@@end
Step6: Associate action “CloseWindow” with the “CloseWindowButton
” and use this code inside implementation of  “DisplayView”
  public void onActionCloseWindow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
    //@@begin onActionCloseWindow(ServerEvent)
   IWDWindow window = wdContext.currentContextElement().getWindowInstance();
   window.destroyInstance();
    //@@end
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5f699f90-0201-0010-14a4-8950177281ed">Developing with Tables in WebDynpro</a>
Regards,
Mithu

Similar Messages

  • Reg Row Selection in a Table

    Hi All,
    I am facing a problem with row selection in a table. When I navigate from one screen to another in my application, the selected rows in the previous screen should be populated in the table in the next screen.
    If I have to use checkboxes inside the table for multiple row selection, how could I populate the table in the next screen with all the selected rows of the table from the previous screen.
    Also, is it possible to select multiple rows in a table without using checkboxes, and by selecting the "selection mode" of table as "multi", so that initially when the page is loaded no record (row) should be selected automatically.
    Please help me regarding this.
    Regards,
    Murthy.

    Hi,
    As Armin suggested you can use the inbuilt multiselection property of the table.
    For populating the selected values in a table in second view
    First view Context structure
    -EmpDetails (Table node) (cardinality 0..n,selection 0..n,intializeleadSelection - false)
    ---EmpID (table column)
    ---Name  (table column)
    Second View Context structure
    -DispalySelected (Table node)-EmpDetails (Table node) (cardinality 0..n,intializeleadSelection - false)
    --- ID(table column)
    --- Name(table column)
    create a navigation link form first view to second view
    In the InBoundPlug of second view
        wdContext.nodeDisplaySelected().invalidate();
        for(int i=0;i<wdContext.nodeEmpDetails().size();i++)
             if(wdContext.nodeEmpDetails().isMultiSelected(i))
                   IPrivateDisplayView.IDisplaySelectedElement ele = wdContext.nodeDisplaySelected().createDisplaySelectedElement();
                   wdContext.nodeDisplaySelected().addElement(ele);
                   ele.setID(wdContext.nodeEmpDetails().getEmpDetailsElementAt(i).getEmpID());
                   ele.setName(wdContext.nodeEmpDetails().getEmpDetailsElementAt(i).getName());
    <b>For multiselecting you have to use Ctrl tab</b>

  • How to dynamically display the data from a table base on row selection of another table in ADF

    Hi ,
    I have a requirement in ADF. I need to change the data of a table  based on row selection of another Table . Both the table have a Parent Child relationship between them. They have a common attribute say department_id.
                                                                                         For this I created bind variable in view object of employees table and wrote a where clause in the sql query using that bind variable. Then I created method for selection listener of department Table in java bean.
    My method is following
        public void onrowselection(SelectionEvent selectionEvent) {
            RichTable richTable = (RichTable)selectionEvent.getSource();
                            CollectionModel tableModel = (CollectionModel)richTable.getValue();
                            JUCtrlHierBinding adfTableBinding = (JUCtrlHierBinding)tableModel.getWrappedData();
                            Object selectedRowData = richTable.getSelectedRowData();
                            JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding)selectedRowData;
                    oracle.jbo.domain.Number newVal = (oracle.jbo.domain.Number) nodeBinding.getAttribute("DepartmentId");
                    Number pallet = newVal.bigDecimalValue();
                    System.out.println("Selected values " + pallet);
            BindingContext bindingctx = BindingContext.getCurrent();
                          BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
                          DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
                  DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("EmployeesView1Iterator");//access the iterator by its ID value in the PageDef file
                          ViewObject vo =dciter.getViewObject();
                          vo.setNamedWhereClauseParam("DepartmentId", pallet);//enter your value
                          vo.executeQuery();
    It is printing the selected value of department id from department table in the log. But it is not able to pass the value to employees view. It is showing the following error in the log
    "Definition DepartmentId of type Variable is not found in EmployeesView1."
    I will be very thankful if someone helps me to solve this errror or is there any other way to achieve the same requirement.
    Thanks
    Nilesh

    Note quite sure why you simply wont create a viewlink for the viewobject the tables are based on..
    The viewlink attribute will be based on the departmentId and it's a simple master detail relationship which automatically uses ppr.
    However, if both tables are on the same page; using your hack about;
    On the underlying viewobject, define a viewcriteria e.g. "listById" and set your bind variable here.
    I would bind table two to a RichTable component:
    RichTable t2;
    public void onrowselection(SelectionEvent selectionEvent) {
            RichTable richTable = (RichTable)selectionEvent.getSource();
                            CollectionModel tableModel = (CollectionModel)richTable.getValue();
                            JUCtrlHierBinding adfTableBinding = (JUCtrlHierBinding)tableModel.getWrappedData();
                            Object selectedRowData = richTable.getSelectedRowData();
                            JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding)selectedRowData;
                    oracle.jbo.domain.Number newVal = (oracle.jbo.domain.Number) nodeBinding.getAttribute("DepartmentId");
                    Number pallet = newVal.bigDecimalValue();
                    System.out.println("Selected values " + pallet);
                   refreshTable2(pallet);
            BindingContext bindingctx = BindingContext.getCurrent();
                          BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
                          DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
                  DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("EmployeesView1Iterator");//access the iterator by its ID value in the PageDef file
                          ViewObject vo =dciter.getViewObject();
                          vo.setNamedWhereClauseParam("DepartmentId", pallet);//enter your value
                          vo.executeQuery();
    private void refreshTable2(Number pallet){
    RichTable x=getT2();
    CollectionModel cm=(CollectionModel)x.getValue();
    JUCtrlHierBinding jcb=(JUCtrlHierBinding)cm.getWrappedData();
    BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding(jcb.getName()+"Iterator");
    ViewObject vo =dciter.getViewObject();
    ViewCriteriaManager vcm=vo.getViewCriteriaManager();
    ViewCriteria vc=vcm.getViewCriteria("listById");
    vo.applyViewCriteria(vc);
    vo.setNamedWhereClauseParam("DepartmentId",pallet);
    vo.executeQuery();
    AdfFacesContext.getCurrentInstance().addPartialTarget(getT2());

  • How to populate a table based on a row selection from another table.

    Hi, i just started to use ADF BC and Faces. Could some one help me or point me a solution on the following scenario .
    By using a search component , a table is being displayed as a search result. If i select any row in the resulted table , i need to populate an another table at the bottom of the same page from another view. These two tables are related by primary key . May i know how to populate a table based on a row selection from another table. Thanks
    ganesh

    I understand your requirement and the tutorial doesn't talk about Association between the views so that you can create a Master-Detail or in DB parlance, a Parent-Child relationship.
    I will assume that we are dealing with two entities here: Department and Employees where a particular Department has many Employees and hence a Parent-Child relationship.
    Firstly, you need to create an Association between the two Entities - Department and Employees. You can do that by right clicking on the model's entity and then associating the two entities with the appropriate key say, DepartmentId.
    Once you have done that, you need to link the two entities in the View section with this Association that you created. Then go to AppModule and make sure that in the Available View Objects: 'EmployeesView' appears under 'DepartmentView' as "EmployeesView via <link you created>". Shuttle the 'DepartmentView' to the right, Data Model and then shuttle
    "EmployeesView via <link you created>" to the right, Data Model under 'DepartmentView'.
    This will then be reflected in your Data Controls. After that, you simply would have to drag this View into your page as a Master-Detail form...and then when you run this page, any row selected in the Master table, would display the data in the Detail table.
    Also, refer to this link: [Master-Detail|http://baigsorcl.blogspot.com/2010/03/creating-master-detail-form-in-adf.html]
    Hope this helps.

  • How to disable first row selection in a table

    Hi,
    I have three tables which have master child relationship. I need to enable a button for each table based on row selection of corresponding table.But first row is being selected automatically and the buttons are enabled.
    what should i do in order to avoid first row selection in a table.I tried by removing selected Row Keys.But still i am getting the same problem.can anyone suggest on this.
    Thank You,
    Sukumar

    I know a hack but I don't recommend it, anyway here it goes:
    Remove selected Row Keys
    Change selectionListener from the default and create a custom action listener (You can call the default one inside of it) (Tip: use makeCurrent function in this PDF
    This will make sure that there is no selected row highlighted for the first time, but it actually means that the first row is selected, it's just not shown.
    This method is tested with 11.1.1.7

  • Keep view in row selected in the table

    Hello,
    i have a webdynpro view with a table. This table has 256 records, and visibleRowCount property is set to 10 records.
    My problem is when i selected the record number 174 for example, the scroll table returns to position 1 and i can not see the record selected.
    How can i do for the scroll table keep the row selected in the table?
    Thank you

    Hi,
    Try this.
    1. create one context ctx_va_firstvisblerow.
    2.get the leadselection record and set ctx_va_firstvisblerow context.write this code in wdDoModifyView.and also following code in wdDoModifyView.
    IWDTable table = (IWDTable) view.getElement("Ur table id");
        table.setFirstVisibleRow(wdContext.currentContextElement().getCtx_va_visiblerow());
    3.Bind the ctx_va_firstvisblerow context to the table FirstVisibleRow.
    Thanks
    Abhilasha
    Edited by: Abhilasha Dahare on Sep 14, 2010 3:35 PM

  • To determine the number of rows selected in a table view (BSP)

    Hi,
    My requirement is:
    I would be selecting 1 row from a table view ( which is made multiselect for another requirement) , and press a button.
    The functionality of button is to open a popup window based on the row selected.
    I want to display an error message if more than 1 row is selected, and button is clicked.
    Message will say that "you cannot select more than 1 row".
    For this,  I need to know how I can get the number of selected rows in a table view.
    I tried using the below code.
    But I feel this will work only in DO_HANDLE_DATA method.
    The popup would open, even before control comes in this method.
      CALL METHOD cl_hrrcf_iterator=>get_tv_index
        EXPORTING
          p_id               = p_tableview_id
          pt_form_fields = table_form_fields
        IMPORTING
          pt_indices      = sel_row_index_tab.
    Could you please provide me with a solution.
    Quick replies will be highly appreciated.
    Thanks,
    Nisha Vengal.

    Hi ,
    Your TV :
    <htmlb:tableView id              = "tv1l"
                                   design          = "alternating"
                                   visibleRowCount = "10"
                                   fillUpEmptyRows = "true"
                               onRowSelection  = "MyEventRowSelection" <----This is the event you have to use
                                   selectionMode   = "MULTILINEEDIT"
                                  filter          = "SERVER"
                                   table           = "<%= some table %>" >
    in DO_REQUEST:
    DATA:  tv                  TYPE REF TO cl_htmlb_tableview,
           tv_event          TYPE REF TO cl_htmlb_event_tableview ,
           event             TYPE REF TO if_htmlb_data.
    event = cl_htmlb_manager=>get_event( request ).
    IF event IS NOT INITIAL AND event->event_name = htmlb_events=>tableview.
      tv_event ?= event.
      CASE event->event_server_name.
        WHEN 'MyEventRowSelection'.
    count = count + 1 .
    if count ne 1 .
    errmsg = 'Your message'.
    endif.
    ENDCASE.
    ENDIF.
    in View/Layout:
    <% if errmsg is not initial. %>
    <s cript t y p e   =   t e x t / j a v a s c r i p t >
    a l e r t ("<%= errmsg %>") .
    </ s c r i p t>
    <% clear errmsg. %>
    <% endif. %>
    errmsg is a class attribute of type string and count is also a class attribute of type c .
    Regards,
    Anubhav.
    Reward if useful
    Edited by: Anubhav Jain on Sep 19, 2008 3:08 PM

  • Contextual Event on row selection in the table

    Hi,
    My taskflow has just a view activity which queries a view object and displays results as a table. This taskflow is inserted in the main page as a region. I have set up a selection listener on the table, to map to a method in a managed bean. I have made this method binding a producer of my contextual event. and another method binding on the main page as a consumer. I have mapped producer and the consumer on a event map on the main page.
    My problem is when a row is selected in the table, I see the method (in the selection listener) is called but the event is not fired and the consumer method is not called. I don't know, if it is because the producer method (selection listener) takes SelectionEvent as a parameter?.
    I added just to test, a button on my view activity and mapped the action listener to another method(with out parameters) on the same managed bean and made this a producer. In this situation the event got fired and the consumer method got called.
    Why is the selection listener method not firing the event?
    Thanks in advance.

    Hi,
    the two events that are supported for ADF Faces component events are ActionEvent and ValueChangeEvent. So if you have a selection event, you need to take this infromation and create an ActionEvent from it.
    http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/event/ActionEvent.html
    Frank

  • What happens when the row selection of a table is set as 'none'?

    I have a page, with a Search box, Departments and Employees tables. The user will enter a departmentId and click on Search button. Departments will be displayed. The departmentId column in Departments table is surrounded with a link. So when the user will click on the link, the desired employees will be displayed in the Employees table, if there is a view link between the VOs.
    Now suppose I have removed the view link. And the row selection of the Departments table is set as 'none'. So is it possible to get the desired employees of the chosen departmentId in this scenario, as because row selection has been disabled in the Departments table?
    I also dont want to use the Set Property Listener in this use case.

    Hi,
    If you have disabled rowselection and also are not implementing the selection listener? How will you find which row did the user select?
    Ramandeep

  • Row selection across multiple tables

    Hi
    I currently have multiple tables where, if the user selects a particular row or group of rows in one table the correspondign row or group of rows is selected in the other table.
    At the moment I've acheived this by placing listSelection listeners on all the tables so that when the selection on one table changes it fires an event and updates the slection on the other tables using:
    secondTable.setRowSelectionInterval(
    firstTable.getSelectedRows()[0],
    firstTable.getSelectedRows()[firstTable.getSelectedRowCount() - 1]
    );This works fine if the user selects a single row or a continuous group of rows. THe problem is if the user selected a non-continuous group, or selects a continuous group and then deselects some of these rows.
    Because the method I've got selects all rows between the start and finish of the selection it means rows are highlighted on the other tables that are not highlighted on the first table.
    My thoughts on how to approach this would be to cycle through the array of selected rows and select the corresponding rows in the other tables individually rather than selecting a range, but I can't see how to accomplish this. Could anyone give me some pointers or suggestions.
    Thanks

    What you are doing is correct in principle (use a
    listener to propagate the selection)
    Always a good start :-)
    but you need to
    understand the subtleties of the ListSelectionEvent -
    read the API carefully - it gives you a range of
    indices which may have changed but does not tell you
    whether any specific indices in that range are
    selected or unselected.
    That makes sense, the event just indicates that the selection has changed yes?
    For that you will need to get
    the source ListModel from the event and query each
    row in the event range to determine its selection
    state.
    This is where I run into difficulty. I think I can go through the each row and find out if its selected or not (using isSelectedIndex(i))
    What I'm unsure what to do is how to set that for the rows in the other ListModels. What I would have normally done would be something like
    otherListModel.getIndex(i).setSelected(firstListModel.isSelectedIndex(i));But as the api doesnt list the methods to do that I think I might not have got this concept sorted in my head. Could someone provide me with some pointers?
    Thanks

  • Row Selected in a table

    Hi,
    I have a table on a view of my dynpro and by default the first row is selected.
    How I can show my table without any row selected?
    Tks a lot.

    Hi,
    In your view go to the method WDDOMODIFYVIEW and use the following code to deselect the row.
    DATA: o_node_output_data     TYPE REF TO if_wd_context_node.
      o_node_output_data = wd_context->get_child_node( name = '<context table name>' ).
      o_node_output_data->set_lead_selection_index( o_node_output_data->no_selection ).
    Let me know if that works.
    Regards
    Prasenjit

  • How to perform Autosubmit  on Row selection in ADF Table

    Hi,
    I am using ADF Table , in which I want to enable AutoSubmit for the Table Row Selection.
    I want to enable some button on my screen when a row is selected in the table.
    I want to achive this with out using SelectionListener .. any iputs for this?
    Thanks,
    Swathi

    Hi Timo,
    here is my code : this code is to implement Custom shuttle .. where I am using two ADF Tables to display the Available list and Selected List ..and using navigation buttons to move the selected item.When I select a Row in the left table .. I want to enable the 'add' button.
    <af:table value="#{pageFlowScope.ebean.al}" var="row"
                      rowBandingInterval="0" varStatus="vs" id="t2"
                      rowSelection="single"
                      binding="#{pageFlowScope.ebean.availableList}"
                      partialTriggers="::cb2 ::cbAdd ::cbRemove"
                      summary="#{backingBeanScope.BundleBean.MEASURES}"
                       selectionListener="#{pageFlowScope.ebean.rowSelection}"
                      inlineStyle="height:200.0px;" horizontalGridVisible="false">
              <af:column sortProperty="Name" sortable="false"
                         headerText="Name"
                         id="c3" width="300" rowHeader="unstyled">
                <af:panelGroupLayout id="pgl6">
                  <af:image source="/images/file_ena.png" id="i2"
                            shortDesc="#{backingBeanScope.BundleBean.FILE_ENA}"/>
                  <af:outputText value="#{row.label}" id="ot2"/>
                </af:panelGroupLayout>
              </af:column>
            </af:table>
          </af:panelGroupLayout>
          <af:panelGroupLayout id="pgl3" layout="vertical"
                               inlineStyle="width:39px;">
            <af:commandButton id="cbAdd"
                              actionListener="#{pageFlowScope.ebean.onAdd}"
                              partialSubmit="true"
                              disabled="#{pageFlowScope.ebean.dataToAdd==null}"
                              icon="/images/shuttleright_ena.png"
                              shortDesc="#{backingBeanScope.BundleBean.ADD}"
                              partialTriggers="t2"/>
            <af:spacer width="10" height="10" id="s1"/>
            <af:commandButton id="cbAddAll" action="addAll"
                              actionListener="#{pageFlowScope.ebean.onAddAll}"
                              disabled="#{pageFlowScope.ebean.availableListSize==0}"
                              icon="/images/shuttlerightall_ena.png"
                              shortDesc="#{backingBeanScope.BundleBean.ADD_ALL}"
                              partialTriggers="cbRemove"/>
            <af:spacer width="10" height="10" id="s2"/>  
            <af:commandButton id="cbRemove" partialSubmit="true"
                              actionListener="#{pageFlowScope.ebean.onRemove}"
                              icon="/images/shuttleleft_ena.png"
                              shortDesc="#{backingBeanScope.BundleBean.REMOVE}"
                              partialTriggers="t3"
                              disabled="#{ pageFlowScope.ebean.dataToRemove==null}"/>
            <af:spacer width="10" height="10" id="s4"/>
            <af:commandButton id="cbRemoveAll"
                              actionListener="#{pageFlowScope.ebean.onRemoveAll}"                         
                              icon="/images/shuttleleftall_ena.png"
                              shortDesc="#{backingBeanScope.BundleBean.REMOVE_ALL}"
                              disabled="#{pageFlowScope.ebean.listSize==0}"
                              partialTriggers="cbAdd "/>
          </af:panelGroupLayout>
          <af:panelGroupLayout id="pgl5">
            <af:outputText value="#{backingBeanScope.BundleBean.SELECTED_MEASURES}#{pageFlowScope.ebean.listSize}#{backingBeanScope.BundleBean.CB}"
                           id="ot3"
                           inlineStyle="font-weight:bold; font-size:small;"
                           partialTriggers="cbAdd cbRemove"/>
            <af:table value="#{pageFlowScope.ebean.sl}" var="row"
                      rowBandingInterval="0" varStatus="vs" id="t3"
                      rowSelection="single"
                      binding="#{pageFlowScope.ebean.list}"
                      partialTriggers="::cbAdd ::cbAddAll ::cbRemove ::cbRemoveAll"
                      summary="#{backingBeanScope.BundleBean.MEASURES}"
                      selectionListener="#{pageFlowScope.ebean.rowSelection}"
                       inlineStyle="height:200.0px;" horizontalGridVisible="false">
              <af:column sortProperty="Name" sortable="false"
                         headerText="Name"
                         id="c5" width="300" rowHeader="unstyled">
                <af:panelGroupLayout id="pgl9">
                  <af:image source="/images/file_ena.png" id="i3"
                            shortDesc="#{backingBeanScope.BundleBean.FILE_ENA}"/>
                  <af:outputText value="#{row.label}" id="ot1"/>
                </af:panelGroupLayout>
              </af:column>
            </af:table>
        </af:panelGroupLayout>
    public void rowSelection(SelectionEvent selectionEvent) {
            RichTable at = (RichTable)selectionEvent.getComponent();
            if(at.getId().equals("t2"))
                getDataToAdd();
            else          
               getDataToRemove();       
        public Object getDataToAdd(){
            if(availableList!=null)
         return availableList.getComponent().getSelectedRowData();
            return null;
        public Object getDataToRemove() {       
            if (list != null && list.getComponent().getSelectedRowKeys()!=null)
                    return list.getComponent().getSelectedRowData();
            return null;
        }Thanks,
    Swathi

  • Multiple row selection in ADF Table using addition column with checkbox

    I am using ADF table(Jdeveloper11g) and i want to selecte multiple rows it may be more than one OR all rows.
    For that i added one Column to the table with Header Delete and checkbox
    <af:table....
    <af:column sortProperty="Delete" headerText="Delete" width="100"
    sortable="false">
    <af:selectBooleanCheckbox label="#{row.favoriteId}"
    valueChangeListener="#{Mybean.onCheck}"
    id="checkbox" autoSubmit="true">
    </af:selectBooleanCheckbox>
    </af:column>
    </af:table>
    backing bean:Here i added code to get Value of one column with id favoriteId and use an arrayList(listForDelete) to monitor the state of the checkboxes
    public void onCheck(ValueChangeEvent valueChangeEvent) {
    BindingContainer bindings = getBindings();
    DCBindingContainer dcBindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding iterBind =
    (DCIteratorBinding)bindings.get("getUserFavoritesByUserIDIterator");
    if (iterBind != null && iterBind.getCurrentRow() != null) {
    RichSelectBooleanCheckbox ch = (RichSelectBooleanCheckbox)valueChangeEvent.getSource();
    if (!ch.isSelected()) {
    Long issueId = (Long)iterBind.getCurrentRow().getAttribute("favoriteId");
    listForDelete.add(issueId);
    else
    Long issueId = (Long)iterBind.getCurrentRow().getAttribute("favoriteId");
    listForDelete.remove(issueId);
    Problem is that when i select single row checkBox, onCheck() method of backing bean gets called multiple times(equals to the number of rows)
    I think this is beacuse of <af:selectBooleanCheckbox id is same that is "checkbox" but i am not sure.Even i tried to assign some unique id but no any success in assigning Id with value Expression.
    I also find related post
    Re: ADF Table Multiple row selection by Managed Bean
    but that is related to Select All rows or Deselect all rows from table.
    From the simillar post i follow the steps given by Frank.but problem with below step
    ->have an af:clientAttribute assigned to the checkbox with the following EL #{row.key} ,here I added <af:clientAttribute name="#{row.key}"></af:clientAttribute> and i am getting error
    Error(64,37):  Static attribute must be a String literal, its illegal to specify an expression.
    Please let me know if any one had already implemented same test case.
    Thanks for all help
    Jaydeep
    Edited by: JaydeepJ on Aug 7, 2009 4:42 AM

    just to update after the rollback is called in the cancel button i wrote following code which does not change the row focus to the first row
    DCBindingContainer bc =
    (DCBindingContainer)BindingUtils.getBindingContext().getCurrentBindingsEntry();
    DCIteratorBinding profItr =
    bc.findIteratorBinding("ProfileSearchInstIterator");
    Row cRow = profItr.getRowAtRangeIndex(0);
    if(cRow != null){
    System.out.println("Current row is not null so fixed ");
    profItr.setCurrentRowIndexInRange(0);
    RowKeySetImpl rks = new RowKeySetImpl();
    ArrayList keyList = new ArrayList();
    keyList.add(cRow.getKey());
    rks.add(keyList);
    profileTable.setSelectedRowKeys(rks);
    AdfFacesContext.getCurrentInstance().addPartialTarget(profileTable);
    }

  • Ttitle not displaying the title when no rows selected from a table

    My requirement is display the Ttitle value even when there are no rows fetched from a table. I tried the following -it didn't work. We are on Oracle 9.2.0.7.0. Anybody has thoughts on this... your help greatly appreciated.
    ORACLE_SID = [oracle] ? ABCDE
    PSDEVDB1:>sqlplus babu
    SQL*Plus: Release 9.2.0.7.0 - Production on Mon Jul 10 17:56:52 2006
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Enter password:
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.7.0 - Production
    SQL> ttitle center 'testing'
    SQL> column x noprint
    SQL> select 'x' x from dual;
    testing
    SQL> select *from mytable3;
    testing
    NAME NO
    KUMAR 10
    RAMU 10
    BABU 10
    SQL> select *from mytable3 where no=20;
    no rows selected
    SQL>

    If your concepts are clear for Right outer join, Left outer join and Full outer join you can achieve what you are looking for.
    http://www.oreillynet.com/pub/a/network/2002/04/23/fulljoin.html
    Play with the data and may the force be with you.

  • Retrieving multiple rows selected from a table

    I want to retrieve selected multiple rows from a table and pass it to other views. Does anyone know how to implement this

    You could try a simple example:
    Create a context node "Rows" with a string attribute "Text". Create some node elements in wdDoInit().
    Create an action "ShowSelectedRowIndices" and implement the event handler as follows:
      //@@begin javadoc:onActionShowSelectedRowIndices(ServerEvent)
      /** Declared validating event handler. */
      //@@end
      public void onActionShowSelectedRowIndices(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionShowSelectedRowIndices(ServerEvent)
        StringBuffer msg = new StringBuffer("Multi-selected rows:");
        for (int i = 0; i < wdContext.nodeRows().size(); ++i)
          if (wdContext.nodeRows().isMultiSelected(i))
            msg.append(" ").append(i);
        wdComponentAPI.getMessageManager().reportSuccess(msg.toString());
        //@@end
    When executing the action (e.g. with a button) you will see the selected indices in the message area.
    Regards, Armin

Maybe you are looking for

  • Need help with Report for Lag Forecast

    Hi All, I need your inputs in creating a Report to show Lag Forecast. Forecast is done on a weekly basis. Assuming forecast is done at a time for 3 upcoming weeks, the data in the cube will be as follows: ZCALWEEK     CALWEEK     MATERIAL     FORECAS

  • Portrait/Landscape Question

    Using Reports 6i I have a report that has it's orientation set to default in the Header, Main and Trailer section in the Layout Editor. However, the width is set to 11 and the height to 8.5 in the same properties. When the report is run through the p

  • How to convert characterisitics of a materila to external format

    Hi All, I am fetching characteristics value(present in Classification view) of a material using the FM 'CLLA_CHANGE_DOC_CLASSIFICATION'.But it gives the old value and new value in internal foramat.How can i convert the characteristics values to exter

  • How to make this functionality in a block

    Hi, i have 12 record db block on my forms..on the canvas 4 items are display items while 5 are text items... i want to implement the fucntionality like this site has on my block pls click the following link to open a page in internet explorer and whe

  • Adobe Reader XI display

    Adobe Reader XI. When I double click on a pdf file I get the full pdf file but not the surrounding window where I can quit, resize, etc until I open and close the comments or clicking several times within the pdf file.