Selected Row Index of Advanced datagrid

Hi All,
I have an Advanced Data grid with about 100 rows in it. I have both editable and non editable fields in the grid. When I click on a row and select the row iam not able to get the selected row index correctly.Even if i click on the middle of the datagrid it is always displaying the first row only.
I want to get the selected row index of hte advanceddata grid correctly both in mouse click and key press.
Actually I want to display the data of the selected row in a jsp page.
What event should I use and some code example please.
Could anyone help please.
Regds
Sangeetha

What have you tried so far?

Similar Messages

  • How to get selected  row index  of a Table ?

    hi gurus,I'm new  to Webdynpro for abap
    I'm displaying    just Flight details in a Table  so
    how to get selected  row index  of a  Table  and need  to be display in Message manager.

    Hi,
    For getting the row index use the following code.
    DATA lo_nd_node TYPE REF TO if_wd_context_node.
      DATA lo_el_node TYPE REF TO if_wd_context_element.
      DATA index TYPE i.
    * navigate from <CONTEXT> to <NODE> via lead selection
      lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
      lo_el_node = lo_nd_node->get_lead_selection(  ).
      index = lo_el_node->get_index( ).
    node is the name of the node which is binded to the table.
    For printing the message u can use code wizard.
    Press ctrl-F7. Now Select generate message.
    IN this select the method  REPORT_SUCCESS
    In the code now u can give index to Message text Exporting parameter. Comment receiving parameter.
    Write the whole code in onLeadSelect of the table.
    Regards,
    Pankaj Aggarwal

  • How to move multi select rows(records)from one datagrid to another datagrid completelly in flex4

    hi friends,
    I  am doing mxml flex 4 wep application i am using 2 forms, each form i am using datagrid,i am struck in this place,
    my proplem is, in first form i am having a grid with 10rows and columns,i am having 10 records and one move button. Next form also having a datagrid,
    need:
    IF i am doing multi select(2records) from the first datagrid and click move button means that records will show in the second datagrid and will also delete
    from the first data grid again it wont show the records in same datagrid.
    how to do this?
    any useful suggession or snippet code.
    thanks in advance,
    Cheers,
    B.venkatesan.

    One solution could be:
    Source to data grid is an Array collection
    1.> In first data grid extraxct the rows using, grid.selecteditem
    2.>Add it to the arraycollection attached to next grid, use arraycollection addItemat api if rows needed to ve added at particular index
    3.>Use removeitemat api to remove the items from arraycollection attached to first datagrid
    4.>call invalidate on bothe of the datagrids

  • How to get selected Row Index in a table based ona  VO?

    Hi All,
    I'm writing an ADF form wherein I use a VO based on a SQL query. I'd like to know how to get the index of a selected row. I havea selection Listener in place where I can print the selected Row's data using getSelectedRowData().toString() on the table.
    How can I get certain Attributes from this selected row.
    One solution I thought of is to get the row index and then read attributes. But I cant seem to figure out how to get rowIndex for a selected row. Any sugestions?
    Using JDeveloper 11g.
    Thanks
    P.

    If your selected row is marked as current row you can use
    // Get a attribute value of the current row of iterator
    DCIteratorBinding iterBind= (DCIteratorBinding)dcBindings.get("testIterator");
    String attribute = (String)iterBind.getCurrentRow().getAttribute("field1");Where 'testIterator' is the name of the iterator you use for the table and 'field1' is the name of an attribute you want to get.
    Or you can iterate over the selected row keys (even if it's only one):
    // get  selected Rows of a table 2
    for (Object facesRowKey : table.getSelectedRowKeys()) {
    table.setRowKey(facesRowKey);
    Object o = table.getRowData();
    JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)o;
    Row row = rowData.getRow();
    TestRow testRow = (TestRow)((DCDataRow)row).getDataProvider() ;
    }Where TestRow is the row type of the VO of your table.
    Timo

  • SALV - ALV selected row Index - Not getting in second time

    I am having a ALV grid using CL_SALV_TABLE class. and its have PF-status button "Display" and user select a line and press "Display" button system will display a PDF document from content server.
    The following is the code i am using for getting index of selected row.
    My problem is user select a line for the first time i am getting the index, but user select second time i am not getting the index
    module user_command_0300 input.
      call method cl_gui_cfw=>dispatch.
      case ok_code.
        when c_hist.
          perform f_show_history.
        when others.
      endcase.
      clear ok_code.
    endmodule.                            
    then
    form f_show_history.
      data : p_wa_rows    type int4.
      data : p_i_rows     type salv_t_row.
      gr_table->get_metadata( ).
      p_i_rows = gr_selections->get_selected_rows( )." Here Its failing in second time. P_I_ROWS showing blank second time
      clear: wa_output.
      read table p_i_rows into p_wa_rows index 1.
      if sy-subrc eq 0.
        read table i_output into wa_output index p_wa_rows.
        if sy-subrc eq 0.
          perform f_display_document.
        endif..
      endif.
      refresh : p_i_rows. clear : p_i_rows.
      gr_selections = gr_table->get_selections( ).
      gr_selections->set_selected_rows( p_i_rows ).
      gr_table->refresh( ).
      call method cl_gui_cfw=>set_new_ok_code( new_code = 'REFR' ).
    endform.                                 " F_show_history
    PS : I don't want to place the button in the ALV application toolbar

    Hi Dear,
    I have some clue regarding your problem but that is in simple Alv not in oops.
    declare a first field of your internal table i.e. you are passing to alv as cell type c.
    then in layout
    add
    gs_layout-box_fieldname     =   'SEL'.
    pass this layout to alv.
    then you are able to get exact row number.
    LOOP AT gt_gi INTO gs_gi WHERE sel = 'X'.
            gs_gi-sel = ' '.
            APPEND gs_gi TO gt_gi.
            CLEAR gs_gi.
          ENDLOOP.
    Hope this clue will help you.
    Regards,
    Vijay

  • Issue With select Check box in advance datagrid

    Hi
           i am using advance datagrid having hierarichal data.There is one column having checkbox and one header renderer(CheckBox) on top giving functionality of select all.when i clicked on select all checkbox , all the checkboxes in that column not showing checked unless  i collapse or expand the heirarichal data or scroll the advance data grid,similar is the case with unselect checkbox.however internally values are selected and unselected as per functionality but checkboxes are not show checked/unchecked in first go.i have tried following things to refersh the data but nothing worked.
    refreshing the arrayCollection and then calling invalidateList() on the grid.
    IHierarchicalCollectionView(adg.dataProvider).refresh();
    so please  guide me .
    Thanks in advance
      Vineet Osho

    we have a field to bind the checkbox selected status, such as 'selected', when the data['selected'] = true means the checkbox is checked, otherwise is unchecked
    the itemrenderer code:
    public class CheckBoxADGItemRenderer extends CenteredCheckBox
                        public function CheckBoxADGItemRenderer()
                                  super();
                        override public function set data(value:Object):void
                                  super.data = value;
                                  invalidateProperties();
                        override protected function commitProperties():void
                                  selected = data['selected'];
                                  super.commitProperties();
    when click the header renderer checkbox, change the collection data 'selected' field, when checked, data['selected'] = true;
    then invalidate the check column properties,
    eg:
    private function invalidateCheckColumnProperties():void
                                  var i:int = 0;
                                  var n:int = listItems.length;
                                  var instance:IInvalidating;
                                  for (i = 0; i < n; i++)
                                            instance = listItems[i][0] as IInvalidating;
                                            if (instance)
                                                      instance.invalidateProperties();
    Hope help for your.
    Huang

  • How to get selected row of an advanced table

    Hi All,
    I have created an advanced table with 5 rows and i can also add rows in that. Here my requirement is i want to get the data of a row which i have selected. There are 5 rows. i have entered data into all 5 rows. Suppose i have selected 3rd row i have to get that 3rd row. if i have selected 5th row i have to get 5th row.
    Can you please guide me to achieve this requirement..
    Many thanks
    Murali

    Hi ,
    you have to set the firepartialaction event on your selection button, then use row refernce to get the handle on specific button
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am =
    (OAApplicationModule)pageContext.getApplicationModule(webBean);
    String event = pageContext.getParameter("event");
    if ("<ItemPPREventName>").equals(event))
    // Get the identifier of the PPR event source row
    String rowReference =
    pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    // write your business logic
    Thanks
    Pratap

  • BSP htmlb:tableView Row index

    Hi All
      I stack at a point and need ur help/ suggestion . I have BSP page displaying data in HTML:TABLEVIEW in single select mode .
      Now if i select a row OR Click on a cell , i wnat to know the index number of row selected.
    I am using MVC model so For this i went into  Controller's DO_HANDLE_EVENT in this on debugging mode i found following values :
    htmlb_event                    {O:34*\CLASS=CL_HTMLB_EVENT_TABLEVIEW}
    htmlb_event->server_event      MyEventCellClick
    htmlb_event->row_index                  2
    means i got index htmlb_event->row_index but when i am write the statement :
           qa32clobj->v_index = htmlb_event->row_index.
    it gives me syntax error  :
    Class ZCONTROL_QA32,Method DO_HANDLE_EVENT
    Field "ROW_INDEX" is unknown. It is neither in one of the specified
    tables nor defined by a "DATA" statement. "DATA" statement.     
    please help me.
    Regards
    Sachin Sharma

    Dear Sachin Sharma,
    You can try with this following code.
    data:  loc_table_event type ref to cl_htmlb_event_tableview,
              cnt type i.
       call method cl_hrrcf_iterator=>get_tv_attr
            EXPORTING
              p_tv_id        = 'your tablename'
              p_component_id = me->component_id
              po_request     = me->request
            IMPORTING
              po_tv_event    = loc_table_event.
          if loc_table_event->SELECTEDROWINDEX is INITIAL.
            date_msg = 'Display your error message'.
            return.
          else.
            cnt = loc_table_event->SELECTEDROWINDEX.
          endif.
          if loc_table_event is not INITIAL.
            read table <your tabletype> index cnt into <your structure> .
    Like this you can get your selected row index & get the value.
    Appreciate if its Helpful.
    Regards,
    Anita Vizhi Arasi B

  • Htmlb:tableView Recover the selected row

    Hi.
    How can I recover the selected row in a internal table, with the htmlb:tableView, in the onInputProcessing?
    Thanks very much!
    I'm using this sentence in the "layout":
    <!-- Visualizamos Línea de selección + tabla interna -->
        <htmlb:tableView id             = "myTableView"
                         visibleRowCount = "<%= c_ver_registros %>"
                         width                 = "<%= c_ancho_tabla %>"
                         selectionMode    = "SINGLESELECT"
                         table                  = "<%= T_TABLA %>" >
        </htmlb:tableView>
    null

    hi Marcos,
        While calling the Tableview in the layout get the selected row index in the attribute <b>selectedRowIndex = "<%= var_selectedindex %>"</b>   { where var_selectedindex should be defined as a pageattribute} the tableview definition should be like this..
    <htmlb:tableView id = "myTableView"
    visibleRowCount = "<%= c_ver_registros %>"
    width = "<%= c_ancho_tabla %>"
    selectionMode = "SINGLESELECT"
    <b>selectedRowIndex = "<%= var_selectedindex %>"</b>
    table = "<%= T_TABLA %>" >
    </htmlb:tableView>
    And in the <b>inputprocessing</b> ,
    Try this code..
    IF htmlb_event IS NOT INITIAL AND htmlb_event->if_htmlb_data~event_name = 'tableView' AND
         ( htmlb_event->if_htmlb_data~event_type = 'cellClick'   OR
           htmlb_event->if_htmlb_data~event_type = 'rowSelection' OR
           htmlb_event->if_htmlb_data~event_type = 'navigate' ) .
        DATA  tableview_event TYPE REF TO cl_htmlb_event_tableview.
        tableview_event ?= htmlb_event.
          IF lr_tableview_event->selectedrowindex IS NOT INITIAL .
               var_selectedindex  =  tableview_event->selectedrowindex.
        ENDIF.
      ENDIF.
    regards,
    Bhanu.

  • Selecting rows in ALV Grid using Classes

    I am displaying the output in ALV grid format.
    Now i am using cl_gui_alv_grid->Get_selected_ROWS to get the row index selected by User and on clicking a button it will take us to another screen which will hold the values of the selected row.
    Problem Faced: But when we again go back to the first screen and select another row  or same rows and click this button the selected rows index remains initial, that value is not getting captured.
    I cleared the parameters and refershed grid also.
    But the problem is not yet solved.
    Please Give me the solution.
    Regards,
    Balaji.

    Hi Lavanya,
    I did debugging also.
    First time Get_Selected_rows is working fine.
    But Second time it is failed.

  • How do I set only the first row of a DataGrid as the selected row?

    I have a "Go" button on a search form that fetches data into an already data bound grid.  After the data is fetched, I want to make the first row in the Datagrid the selected row, as if the user clicked on it.  If the result set is empty, I don't want the code to crash.  (I only want one row to be able to be selected at a time)
                protected function btnGo_clickHandler(event:MouseEvent):void
                    getSBJsResult.token = baa_data_svc.getSBJs(cmbSrch.text);
                    grdSBJs. //  ?????  What goes here to select the first row?

    This should do it.
    If this post answered your question or helped, please mark it as such.
    if(myDataGrid.dataProvider.length > 0){
      myDataGrid.selectedIndex = 0;

  • How to get all the index of "selected rows" in table control?

    Hi Gurus,
    I have a table control, wherein I need to get selected row so that I can get its respective TABIX.
    I know that the event for capturing selected row is in PAI.
    I also ensure that the w/ selColumn name in my screenpainter is exactly the same as my declaration in ABAP.
    TOP INCLUDE
    YPES: BEGIN OF Y_ZQID_CHECK,
            IDNUM           TYPE ZQID_CHECK-IDNUM,
            WERKS           TYPE ZQID_CHECK-WERKS,
            MATNR           TYPE ZQID_CHECK-MATNR,
            LICHA           TYPE ZQID_CHECK-LICHA,
            LIFNR           TYPE ZQID_CHECK-LIFNR,
            ECOA_S          TYPE ZQID_CHECK-ECOA_S,
            ID_STAT         TYPE ZQID_CHECK-ID_STAT,
            ID_DATE         TYPE ZQID_CHECK-ID_DATE,
            FLAG_MAILCOA(1) TYPE C,
            MARK(1)         TYPE C, "Name of w/ SelColumn in ScreenPainter: T_ZQIDCHECK_DISCH-MARK
           END   OF Y_ZQID_CHECK.
    DATA: T_ZQIDCHECK_DISCH TYPE STANDARD TABLE OF Y_ZQID_CHECK WITH HEADER LINE.
    PAI
    PROCESS AFTER INPUT.
    * MODULE USER_COMMAND_9004.
    LOOP AT T_ZQIDCHECK_DISCH.
      MODULE READ_TC_DISCH .
    ENDLOOP.
    module READ_TC_DISCH input.
      DATA: W_LINE_SEL TYPE SY-STEPL,
                  W_TABIX    LIKE SY-TABIX.
      GET CURSOR LINE W_LINE_SEL.
      W_TABIX = TC_ID_ONLY-TOP_LINE + w_LINE_SEL - 1.
      MODIFY T_ZQIDCHECK_DISCH INDEX TC_ID_ONLY-current_line.
    If I am selecting single row, I can properly get the selected index via debug.
    BUG:
    When I'm selecting multiple rows in table control, only the last row is always being read inside the loop of my table control.
    Please see the screenshot.
    [url]http://img268.imageshack.us/img268/5739/tcselectedrows.jpg[url]
    Notice in the debug screenshot, even if it's just in the 1st loop of table control, it automatically gets the 4th table control index, instead of the 2nd one.
    Helpful inputs will be appreciated.
    Thanks.
    Jaime
    Edited by: Jaime Cabanban on Dec 9, 2009 3:16 PM

    Hi,
    Are you sure that you have selected multiple line for tablecontrol in the property window of the tablecontrol.
    Flowlogic.
    LOOP WITH CONTROL TC_01.
         Module Get_Marked.
    ENDLOOP.
    Module Pool
    Module Get_Marked.
    read the data from the internal table where mark  = 'X'.
    this should give you only selected records.
    Endmodule.
    Kindly check the tablecontrol property.
    Regards,
    Ranjith Nambiar

  • How can I get the index of the selected row, ALV

    In alv I need to get the selected row id and then calling a screen to show the detailed infomation on this row and providing the ability to update the row.
    I know how to do but do not know how to get the selected index of the alv grid.
    If it was desired based on just double click, it was ok but I have to provide a button and when it is clicked the detailed screen will come with the selected row details.
    Thanks everyone.
    Deniz.

    Hi Deniz,
    While defining the internal table which u pass in ALV_GRID function module, define a field (suppose CHECK type c) in the structure of that internal table.
    and while defining field layout, pass the value 'CHECK' to the field BOX_NAME of the layout.
    Now, when you execute the report, a selection box will be displayed infront of every record. If you select that record and press the button on application tool bar, the field 'CHECK' in the internal table will be having the value 'X'... By looping throught this internal table where check = 'X', you can achieve your functionality.
    Example:
         Structure for output details
    TYPES: BEGIN OF GS_OUTPUT.
            INCLUDE STRUCTURE ZAS_WATER_QLTY_REP.
    TYPES: CHECK(1) TYPE C,
           END OF GS_OUTPUT.
        Internal    table for output details
    DATA: GT_OUTPUT   TYPE STANDARD TABLE OF GS_OUTPUT.
    Before calling the function module to display ALV
    grid, define a layout usine
    Local workarea
      DATA: LW_LAYOUT  TYPE SLIS_LAYOUT_ALV.
    Local constants
      CONSTANTS: LC_UFORM  TYPE SLIS_FORMNAME
                        VALUE 'ALV_USER_COMMAND'.
    LW_LAYOUT-BOX_FIELDNAME = 'CHECK'.    "Field for checkbox
    This function module outputs an internal table with whatever
    structure in the form of a formatted single- order multi-line list
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM       = LV_REPID
                I_CALLBACK_PF_STATUS_SET = G_FORM_SET_PF_STAT
                I_CALLBACK_USER_COMMAND  = LC_UFORM
                I_STRUCTURE_NAME         = LV_ZAS_WATER_QLTY_REP
                IS_LAYOUT                = LW_LAYOUT
                IT_FIELDCAT              = G_FIELDCAT_TAB[]
                I_DEFAULT                = GC_X
                I_SAVE                   = LC_A
                IS_VARIANT               = G_VARIANT
                IT_EVENTS                = G_EVENTS_TAB[]
                IT_EVENT_EXIT            = G_EVENT_EXIT_TAB[]
                IS_PRINT                 = G_PRINT
                I_SCREEN_START_COLUMN    = G_SCREEN_START_COLUMN
                I_SCREEN_START_LINE      = G_SCREEN_START_LINE
                I_SCREEN_END_COLUMN      = G_SCREEN_END_COLUMN
                I_SCREEN_END_LINE        = G_SCREEN_END_LINE
           TABLES
                T_OUTTAB                 = GT_OUTPUT
           EXCEPTIONS
                PROGRAM_ERROR            = 1
                OTHERS                   = 2.
    and in the form alv_user_command
    FORM ALV_USER_COMMAND USING UCOMM SELLINE TYPE SLIS_SELFIELD.
    case ucomm.
    Lets hope that the user command of the push button in * PUSH
    when 'PUSH'.
    loop at gt_output where check = 'X'.
    You can write your code here...
    endloop.
    endcase.
    ENDFORM.
    Hope this helps...
    Best Regards,
    Phani.
    Message was edited by:
            Sivapuram Phani Kumar

  • 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;

  • [Urgent] Issue with Selected rows in Advanced table

    [I have searched archive and found lots of mails on same issue but none were conclusive so i am asking this again]
    Hi All,
    I have created an advanced table and i want to have functionality of deleting selected rows.
    For implementation of this functionality, i have created a selectflag transient attribute [varchar2] and linked it to multiple select item of Advanced table but the table always returns null for selectflag attribute irrespective of row being selected or not.
    One thing i have noticed is that i can't supply 'checked value' and 'unchecked value' property in advanced table multiple select item. Is that the issue?
    Can anybody please guide, its quite urgent.
    Regards
    Lokesh

    Hi Reetesh,
    Thanks for the reply.
    Yes, you are right i am using same AM at 2 different places.
    Let me just elaborate a little about my implementation:
    I have a Page layout region and within this page layout, i have a query bean which performs results based search.
    Within this query bean, i have added an Advanced table within that query bean to display the results.
    Now coming to multiple AM issue:
    1. Page Layout region must have one AM or its an error.
    2. If i donot add an AM to advanced table, it doesn't return rows.
    So do i need to have 2 diferent AM's for this implementation?
    Regards
    Lokesh

Maybe you are looking for

  • Create new table , 1 column has large amount of data, column type ?

    Hi, sure this is a noob question but... I exported a table from sql server, want to replicate in oracle. It has 3 columns, one of the columns has the configuration for reports, so each field in the column has a large amount of text in it, some upward

  • Inserting row in query

    Can we insert new row after default result rows which can perform additional calculation without using structures.

  • Wind Shake Effect Around Z Axis

    I would like to create a "Wind Shake Effect Around Z Axis". I have a image of the leave in vertical position standing on its stem and would like it to have an appearance as if it trembles in the wind. I applied Wiggle effect. However it wiggles/disto

  • How do i get rid of low disk space message popup HP tools drive E on pavilion g7-1219wm notebook pc

    How do i get rid of low disk space message ( you are running out of disk space on Hp_Tools (E popup HP tools drive E on pavilion g7-1219wm notebook pc.  It is very annoying.  I am i school and I have noticed it since downloading different assignments

  • Customer wants a public IP address for RDP after VPN Tunnel

    I have a customer that wants to set up a VPN tunnel with me with a Public IP address and a Public address for the host. I am completely at a loss as to how to accomplish this. The customer states that it against his company policy to have a remote ho