cancel
Showing results for 
Search instead for 
Did you mean: 

Lead selection how to switch off and how to use?

former_member195355
Participant
0 Kudos

Hiya,

I have a screen where the first row is always selected:

Is there any way to switch this off i.e. I'd still like the user to select a row but I don't want the screen to start with a  row already selected.

Also once a user selects a row - how would I know which row the user has selected and then process only the details of that row?

Thanks for any help!

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Robert,

You can achieve your requirement as below

  •     To switch off the lead selection for first time
    • You need to UN-CHECK the Initialization Lead Selection from properties of you node as below

                   

  • To process the selected row from table
    • Create an action "LEAD_SELECT" in view
    • Set the created action to "OnLeadSelect" event of your table ui element
    • Now, write the below code in event handler method "ONACTIONLEAD_SELECT"

  DATA lo_ctx_element TYPE REF TO if_wd_context_element.
  data ls_data      TYPE wd_this->element_node_name.

    

     "get the selected element

  lo_ctx_element = wdevent->get_context_element( name =
'NEW_ROW_ELEMENT' ).

  IF lo_ctx_element IS NOT BOUND.
    RETURN.
  ENDIF.

" get the data of selected row
  lo_ctx_element->get_static_attributes(
    IMPORTING
      static_attributes = ls_data
  ).

Hope this helps you.

Regards,

Rama

Answers (1)

Answers (1)

former_member222068
Active Participant
0 Kudos

Hi Robert,

1. To unselect row by default, Un check propertie  'Intialization of the node' of the node. so the row of the table will not be selected by default

2. if you want to read or fetch the data of the selected row

a. create an action to the event 'ONLEADSELECT' of a table and write the following logic

DATA: lo_nd_table type ref to if_wd_context_node,

           lo_el_table type ref to if_wd_context_element,

           ls_table     type wd_this->element_table.

lo_nd_table = wd_context->get_child_node( 'TABLE' ).

if lo_nd_table is not initial.

lo_el_table = lo_nd_table->get_element( ).

if lo_el_table is not initial.

lo_el_table->get_static_attributes( importing static_attributes = ls_table ).

endif.

endif.

Note:  Ls_table will return the data of the selected row

b. if you need to read or fetch the selected record of a row ( on action of a button or link )

DATA: lo_nd_table type ref to if_wd_context_node,

           lo_el_table type ref to if_wd_context_element,

           ls_table     type wd_this->element_table.

lo_nd_table = wd_context->get_child_node( 'TABLE' ).

if lo_nd_table is not initial.

lo_el_table = wdevent->get_context_element( 'CONTEXT_ELEMENT' ). " This will return the selected row

if lo_el_table is not initial.

lo_el_table->get_static_attributes( importing static_attributes = ls_table ).

endif.

endif.

Note: wdevent->get_context_element( 'CONTEXT_ELEMENT' ). This will return the data of the lead selection ( eg: Tree ) or particular row data of a table when button or link is clicked.

Hope this should help  you

Thanks & Regards,

Sankar Gelivi