How determine the selected rows in a table

Hi All,
I have a table with a multi selection enabled. Now if the 3 and 5 rows are selected how do I determine this using properties or methods/apis?
Thanks in advance.
Best regards,
Divya

Let <i>Rows </i>be the context node to which the property Table.<i>dataSource</i> is bound.
Then you get the selected context elements / table rows via the context API:
for (int j = 0, n = wdContext.nodeRows().size(); j < n; ++j)
  if (wdContext.nodeRows().getLeadSelection() == j
    || wdContext.nodeRows().isMultiSelected(j)
    /* row at index j is selected */
Armin

Similar Messages

  • How to get the selected rows in a table

    Hi,
    How to get the ids of all the selected rows. On Page load a query is executed that shows the data in a table with a checkbox in the first column to select the rows and delete. Now if a user select multiple rows how do I get the ids of selected rows in the backend code.
    Thanks

    Please search the forum before posting questions.
    refer following thread for table selection.
    Re: Record selection with MessageCheckBox and print the selected record.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                           

  • How to save the  selected rows from Advance table into database

    Hi
    I have requirement like..
    In custom page , Manager Search the Candidates and selects the candidate ROWS from advance table.
    The reqt is how to save the selected multiple rows into the database.

    hi Reetesh,
    In Custom page
    Supoose the Recruiter Search is for Position Finance Mangager , it retrieves 100 rows , out of which Recruiter select 10 rows .
    So in Such scenario how to save this 10 rows against Recruiter
    , i mean , Is i need to create custom table, to save Recruiter , these selected 10 rows.
    I hope u understand my question

  • How to delete or remove the selected row in a table

    Dear Experts,
    I'm facing a typical requirement in VC, similiar to variable selection screen in BI Queries :
    I will have two tabes and if the user selects data from one table it will be moved to target table.I'm able to populate the target table with the value but I'm not able to delete the selected row from the source table.
    Any help in this regard would be highlt appreciated.
    Thankx in advance.
    Regds,
    Srinivasan.

    Hi
    Follow the following steps -
    1. Create two buttons.One for 'delete row' and another one for 'insert row'.
    2. Assign the proper system action as per the name.
    2. Change the name of both buttons as common name.
    3. To trigger the actions simultaneously add a star before the action.( For Example : *select)
    4. Change the visibility of any one of the button as 'false'. (so it will not get displayed)
    5. Now, if u click the visible button both actions will be triggered simultaneously.
    Regards
    Sandeep

  • How to populate the selected row details of table in the next view?

    hi,
    Im having a table, on selecting a particular row of a table by clicking on a radio button. i need that row details to be passed on(populated) to the next view when i navigate to that view by clicking on a button?
    Thanks & Regards,
    Suresh

    Hi Suresh,
    Your scenario is simple. Just follow the ex as shown below
    (Assuming you want default selection view provided by table itself.)
    1>Create 2 views (Ex:A and B)
    2>Create a Context with a node and attributes(For Ex:Person as node and Fname and Last Name as attributes
    2>In A view create a table with F name and L Name(map to context as well) and a action button to navigate to B view when you selected a particualr row o.k
    3>In B view, create a TextView with mapping to LastName(or all the data if you want from input selection) from the context
    If you want you can add back action button from B view to A view for easy navigation.
    4>Execute the application and select any row in the table appeared, press next action button,you can see that the selected row details will be shown in second(B) view.
    If you do the above example, I think you can easily find the solution for navigation issue.. try it out.
    In case if you are not able to ...let me know..I have that example.
    Hope that helps
    Regards
    Praveen

  • Improving performance:How to know selected rows in af:table through chk box

    Hi,
    I've a VO which has 3 transient variables. 2 of these transient variables getting the values from a view accessor. Using the other transient variable in the Ui to select the rows in the af:table.
    In my UI, I've a table and a Check Box to select the rows. I want to get the selected rows through the check box, in the backing bean for my business requirements.
    I've used below logic to get the selected rows. Here, I am iterating through the entire viewobject rows, so it is impacting the performance of the UI. How can I know the selected rows in the bean? or How can I improve the performance?
    I also applied below view criteria, but still its not performant.
    // ViewCriteria vc = vo.createViewCriteria();
    // //.getViewCriteriaManager().getViewCriteria("SelectedMerchantCriteria");
    // ViewCriteriaRow vcr = vc.createViewCriteriaRow();
    // vc.setCriteriaMode(ViewCriteria.CRITERIA_MODE_CACHE | ViewCriteria.CRITERIA_MODE_QUERY);//MerchantName1
    // //vcr.setAttribute("MerchantName1", "1017 CAFE");
    // vcr.setAttribute("SelectToMap", "true");
    // vc.addRow(vcr);
    // vo.applyViewCriteria(vc);
    // vo.executeQuery();
    public void mapSupplierMerchant2(ActionEvent actionEvent) {
    // Add event code here...
    OperationBinding method = null;
    AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
    Map pageFlowScope = adfFacesContext.getPageFlowScope();
    ArrayList merchantMappingList = new ArrayList();
    Long primaryVendorId = null, groupId = null;
    CollectionModel tableModel = (CollectionModel) this.getMerchantTable().getValue();
    JUCtrlHierBinding tableBinding = (JUCtrlHierBinding) tableModel.getWrappedData();
    ViewObject vo = tableBinding.getViewObject();
    // ViewCriteria vc = vo.createViewCriteria();
    // //.getViewCriteriaManager().getViewCriteria("SelectedMerchantCriteria");
    // ViewCriteriaRow vcr = vc.createViewCriteriaRow();
    // vc.setCriteriaMode(ViewCriteria.CRITERIA_MODE_CACHE | ViewCriteria.CRITERIA_MODE_QUERY);//MerchantName1
    // //vcr.setAttribute("MerchantName1", "1017 CAFE");
    // vcr.setAttribute("SelectToMap", "true");
    // vc.addRow(vcr);
    // vo.applyViewCriteria(vc);
    // vo.executeQuery();
    List<JUCtrlHierNodeBinding> merchantList = (List<JUCtrlHierNodeBinding>)tableBinding.getChildren();
    JUCtrlHierNodeBinding merchantNode = null;
    List supToMap = new ArrayList();
    boolean isMerchantSelected = false, isMasterSup = false;
    Long merchantIdToMap = null, masterSupId = null;
    Row r = vo.first();
    while(r!=null) {
    System.out.println("================================ " + r.getAttribute("MerchantName1") + " " + r.getAttribute("SelectToMap") );
    if(r.getAttribute("SelectToMap")!=null) {
    isMerchantSelected = (Boolean) r.getAttribute("SelectToMap");
    if(isMerchantSelected) {
    merchantIdToMap = (Long) r.getAttribute("MerchantMapId");
    if(merchantIdToMap!=null) merchantMappingList.add(merchantIdToMap);
    r = vo.next();
    if(merchantMappingList.size()>0) {
    primaryVendorId = (Long) pageFlowScope.get("primaryVendorId");
    groupId = (Long) pageFlowScope.get("groupId");
    method = (OperationBinding) ADFUtil.findOperation("mapSupplierMerchant");
    if(method!=null) {
    Map paramMap = method.getParamsMap();
    paramMap.put("vendorId", primaryVendorId);
    paramMap.put("groupId", groupId);
    paramMap.put("merchantList", merchantMappingList);
    Boolean result = (Boolean) method.execute();
    List errors = method.getErrors();
    if(result!=null && result) {                   
    this.getMerchantMappedFlag().setValue(true);
    AdfFacesContext.getCurrentInstance().addPartialTarget(this.getMerchantMappedFlag());
    AdfFacesContext.getCurrentInstance().addPartialTarget(this.getMerchantTable());
    tableBinding.getViewObject().setRangeSize(25);
    FacesMessage message = new FacesMessage("The selected merchants have been mapped to the group. Please save the changes. " );//+ adfFacesContext.getPageFlowScope().get("merchantGroupName") );
    message.setSeverity(FacesMessage.SEVERITY_INFO);
    FacesContext.getCurrentInstance().addMessage(null, message);
    } else {
    FacesMessage message = new FacesMessage("No merchants have been selected for mapping. Please select atleast one merchant." );//+ adfFacesContext.getPageFlowScope().get("merchantGroupName") );
    message.setSeverity(FacesMessage.SEVERITY_ERROR);
    FacesContext.getCurrentInstance().addMessage(null, message);
    }

    Hi
    Please check this post [http://adfwithejb.blogspot.in/2012/08/hi-i-came-across-one-common-use-case.html].
    It has clear explanation of how to provide a checkbox for selection of rows. You can also go through my comments at the end of the post. That should solve your problem of iterating through the entire VO.
    Thanks,
    Rakesh

  • ALV - How to set selected rows into internal table

    Hi all,
    I am tying to set with an 'X' flag the selected rows in my ALV using an internal table that contains all rows showed.
    More exactly I have tried to follow these steps.
    1) I have added the filed SEL (type SEL) to my ALV structure zrt_bo_slabsend and I defined my internal table in this way
         DATA: gt_report TYPE STANDARD TABLE OF zrt_bo_slabsend,
                    gw_report TYPE zrt_bo_slabsend.
    2) I have set gw_layo-box_fname = 'SEL' to gw_layo (ALV layout)
    Pressing the "delete button" that I have insert on the top of the ALV, I intercept correctly my user command and I call a form (named "delete_lines") where I have this abap code
    FORM delete_lines.
        DATA: l_subrc          LIKE sy-subrc,
            lw_grid_settings LIKE lvc_s_glay.
    gw_layo-box_fname         = 'SEL'.
                                     "set field name to store row selection
      gw_layo-edit              = 'X'. "makes whole ALV table editable
      gw_layo-zebra             = 'X'.
    gv_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY_LVC'
      exporting
          i_callback_program       = gv_repid
         i_callback_pf_status_set = gc_status
         i_callback_user_command  = gc_user_command
         is_layout_lvc            = gw_layo
         it_fieldcat_lvc          = gw_fkat
         i_grid_settings          = lw_grid_settings
          i_save                   = 'X'
          is_variant               = variant
          it_events                = gt_events
        TABLES
          t_outtab                 = gt_report
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      LOOP AT gt_report ASSIGNING <report> WHERE SEL = 'X'.
        DELETE gt_report.
      ENDLOOP.
    ENDFORM.
    I'd like to select many rows in my ALV report, than by pressing the delete button I'd like to see a refresh of my ALV, without the selected rows. I want to save it only at the end of my action, only by pressing the save button.
    Any suggestion about the abap code will be well appreciated.
    Thanks in advance for your kind help.
    Regards.
        Giovanni

    Hi Giovanni,
    I am using the method:-
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                =
    *   I_BUFFER_ACTIVE                   =
       I_CALLBACK_PROGRAM                = gd_REPID
       I_CALLBACK_PF_STATUS_SET          = 'UDIT'
       I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
    *   I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = 'Mainatin cell entry'
    *   I_GRID_SETTINGS                   =
       IS_LAYOUT_LVC                     = GS_LAYOUT
       IT_FIELDCAT_LVC                   = I_FIELDCAT[]
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS_LVC             =
    *   IT_SORT_LVC                       =
    *   IT_FILTER_LVC                     =
    *   IT_HYPERLINK                      =
    *   IS_SEL_HIDE                       =
       I_DEFAULT                         = 'X'
    *   I_SAVE                            = 'X'
    *   IS_VARIANT                        =
       IT_EVENTS                         =
       IT_EVENT_EXIT                     =
    *   IS_PRINT_LVC                      =
    *   IS_REPREP_ID_LVC                  =
       I_SCREEN_START_COLUMN             = 30
       I_SCREEN_START_LINE               = 14
       I_SCREEN_END_COLUMN               = 120
       I_SCREEN_END_LINE                 = 25
    *   IT_EXCEPT_QINFO_LVC               =
    *   I_HTML_HEIGHT_TOP                 =
    *   I_HTML_HEIGHT_END                 =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = IT_ZCP_DEMAND_SYS1
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    I have made five buttons on my toolbar (add, delete, save, back, exit).
    Kindly tell me how can I catch the sy-ucomm of these buttons.
    NOTE: this FM is written inside an user-exit, so I cannot make forms.
    Thanks in advance.

  • How to maintain selected row in adf table displayed after refresh

    Hi,
    I am using jdev 11g
    I my jsf page I have a table with multiple rows.
    When i scroll and click on one of the rows its selected but if the page is refreshed the row is always selected but not displayed.
    I need to be able to maintain the selected row after the refresh of the page, so my table will look like its already scrolled to the selected row..
    I tried to use the attribute displayRow="selected" but it won't do the trick.
    Any hints
    Emile

    Hi Branislav,
    Kindly answer the following if you may.
    Is there a way to refresh the table after the selectListner is fired.
    Automatically when i select the table i need to refresh it.
    Why after refresh the selected row changes skin.
    Regards

  • How to move the selected rows from a  table control in dialog programming

    hiiiiiiii Every1
    I have to update some fields for a slected row in table control on click of a button and save it in database.
    Regards
    Sachin Dhingra

    see below example, I have added INSERT option after DELETE option, you can use same table or you can use differnt table by populating into that table and insert into the db table. If you want to use same internal table then use below code
    LOOP AT itab INTO demo_conn WHERE mark = 'X'.
    insert into table from itab.
    ENDLOOP.
    REPORT demo_dynpro_tabcont_loop_at.
    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
    DATA cols LIKE LINE OF flights-cols.
    DATA: ok_code TYPE sy-ucomm,
    save_ok TYPE sy-ucomm.
    DATA: itab TYPE TABLE OF demo_conn.
    TABLES demo_conn.
    SELECT * FROM spfli INTO TABLE itab.
    LOOP AT flights-cols INTO cols WHERE index GT 2.
    cols-screen-input = '0'.
    MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
    CALL SCREEN 100.
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'SCREEN_100'.
    ENDMODULE.
    MODULE cancel INPUT.
    LEAVE PROGRAM.
    ENDMODULE.
    MODULE read_table_control INPUT.
    MODIFY itab FROM demo_conn INDEX flights-current_line.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
    save_ok = ok_code.
    CLEAR ok_code.
    CASE save_ok.
    WHEN 'TOGGLE'.
    LOOP AT flights-cols INTO cols WHERE index GT 2.
    IF cols-screen-input = '0'.
    cols-screen-input = '1'.
    ELSEIF cols-screen-input = '1'.
    cols-screen-input = '0'.
    ENDIF.
    MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
    WHEN 'SORT_UP'.
    READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
    IF sy-subrc = 0.
    SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
    cols-selected = ' '.
    MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDIF.
    WHEN 'SORT_DOWN'.
    READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
    IF sy-subrc = 0.
    SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
    cols-selected = ' '.
    MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDIF.
    WHEN 'DELETE'.
    READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
    IF sy-subrc = 0.
    LOOP AT itab INTO demo_conn WHERE mark = 'X'.
    DELETE itab.
    ENDLOOP.
    ENDIF.
    WHEN 'INSERT'.
    READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
    IF sy-subrc = 0.
    LOOP AT itab INTO demo_conn WHERE mark = 'X'.
    itab1 = itab.
    modify itab1.
    ENDLOOP.
    ENDIF.
    if not itab1 is initial.
    INSERT dbtab FROM TABLE itab1.
    endif.
    ENDCASE.
    ENDMODULE.

  • How to control selected row in result table on a search page?

    Using JDeveloper 10.1.3.2.0
    I have attempted to create an ADF page that contains a search and result table in the same page.
    I have questions related to the result table. Let's say the result table shows 10 rows per page.
    If I page forward there is no default selected row "clicked" on the page. Only if you return to
    the very first 10 rows do you see a default selection in row number one of the results.
    How would I go about making the first row of each page the default selection?

    You'll need to code this into the RangeChangeEvent event of the table.
    http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/apidocs/oracle/adf/view/faces/component/core/data/CoreTable.html
    That said - I'm not sure this will be very helpful for the end user - after all in any case they'll need to first select a row before doing an operation on it.

  • How To Edit Selected Row In ALV Table

    Hello Experts,
    In My Webdynpro Application, I am displaying records from database table into an ALV Table.
    I want to edit only selected record from  ALV table.
    Please Suggest How to achieve this.
    Thanks,
    Pratibha

    The link given above is for the UI element 'Table' and does not pertain to ALV.
    To Make an ALV Editable on lead selection for that particular lead selected row.
    1. The ALV should be made lead selectable, when initializing
    2. The ON_LEAD_SELECT function should be invoked.
    3. Withing this function the index has to be retrieved to know which row was selected.
    4. Based on the index retrived all the columns have to pass FALSE to read_only in the column properties.
    Regards,
    Pramod

  • How To get selected row in a table

    Hi experts
                        I have been using a table in which I am using a column Tree by nesting . I have written code for dynamically expanding table tree . But I want to know current selected element of the table, for this i have done following
    steps
    1) created an action on Action <b>lead select </b> of the table .
    which has a parameter with type node element .
    2) now i need to use parameter mapping in domodify view .
    as
    IWDTable tab =  (IWDTable) view.getElement("CatalogTable");
            tab.mappingOfOnLeadSelect().addSourceMapping<b>("XYZ",</b> "element");
    But i dont know what is correct parameter <b>XYZ</b> to be passed.
    also if i am wrong in approach please let me know .
    Regards
    Abhay

    Hi
                I have used following code also but its not working
    IWDTable table  =  (IWDTable) view.getElement("CatalogTable");
    table.mappingOfOnLeadSelect().addSourceMappin               ("IWDNodeElement", "LeadSelect");
    and I have created an action
    public void onActionOnleadSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tut.wd.treetable.wdp.IPrivateTreeTableView.ICatalogElement LeadSelect )
        //@@begin onActionOnleadSelect(ServerEvent)
        wdContext.currentContextElement().setDebug4(LeadSelect.getID());
        //@@end
    but when i select one row its giving error
    <b>com.sap.tc.webdynpro.services.exceptions.WDIllegalArgumentException: Parameter IWDNodeElement not found</b>

  • How to change the default color of the selected row

    hi all,
    I need to know how to change the default color(yellow) of the selected row in a table component.whether i need to change anything in the stylesheet.If so, where should i make the changes in the stylesheet.
    thanks and regards,
    rpk

    The chart colors are being referred to *'palette.cxml'* file in these directories
    BI_HOME\web\app\res\s_oracle10\chartsupport
    BI_HOME\oc4j_bi\j2ee\home\applications\analytics\analytics\res\s_oracle10\chartsupport
    you can change to your custom colors.
    Restart OC4J and PS to make the new ones work..
    Regards,
    Raghu

  • Passing selected rows in a table to Popup Iview

    Hi all,
    I have a main iview in which i search and display some data in a table. Users can select multiple rows from the table and upon clicking on a button in the table toolbar, all the selected rows should be passed to a popup iview.
    But, when i tried, only one value is passed to the popup.
    I need to update a set of rows together from the popup iview.
    Is it a limitation of pop iviews in VC, or did i miss out anything?
    I have selected "multiple select" option for the source table.
    Can anyone advice us on this???
    Thanks alot in advance
    Shobin

    Hi Sreeni,
    Thanks alot for your reply.
    As I saw in some forum posts in SDN, multiple data rows can not be passed to a pop up.
    My application has a list of submitted appointment orders which the authorized person can  approve. I wanted a popup in order to provide a confirmation message when the user multi select and approve many AOs together.
    I found a work around without using pop ups. Instead, I used layers to show the confirmation message. I passed the selected rows to another table using signal in and out.
    It works now.
    Thanks alot
    Shobin

  • How to identify the Selected row number or Index in the growing Table

    Hi,
    How to find the selected Row number or Row Index of growing  Table using Javascript or Formcalc in Interactive Adobe forms
    Thanks & Regards
    Srikanth

    After using bellow script it works fine
    xfa.resolveNode("Formname.Table1.Row1["this.parent.index"].fieldname").rawValue;

Maybe you are looking for